<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><div id="myscoll"></div><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>Linux | XiaoFei🥝</title><meta name="keywords" content="Linux"><meta name="author" content="XiaoFei🥝"><meta name="copyright" content="XiaoFei🥝"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta name="description" content="Linux">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux">
<meta property="og:url" content="https://www.naste.top:1024/posts/1406167115.html">
<meta property="og:site_name" content="XiaoFei🥝">
<meta property="og:description" content="Linux">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://www.naste.top:9000/webp/1515952743765.webp">
<meta property="article:published_time" content="2022-07-04T10:01:02.000Z">
<meta property="article:modified_time" content="2024-04-26T09:52:18.526Z">
<meta property="article:author" content="XiaoFei🥝">
<meta property="article:tag" content="Linux">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://www.naste.top:9000/webp/1515952743765.webp"><link rel="shortcut icon" href="/"><link rel="canonical" href="https://www.naste.top:1024/posts/1406167115"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/6.0.0/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.staticfile.org/fancyapps-ui/4.0.31/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.json","preload":true,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: {"limitDay":365,"position":"top","messagePrev":"It has been","messageNext":"days since the last update, the content of the article may be outdated."},
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":230},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: true,
    post: true
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdnjs.cloudflare.com/ajax/libs/flickr-justified-gallery/2.1.2/fjGallery.min.js',
      css: 'https://cdnjs.cloudflare.com/ajax/libs/flickr-justified-gallery/2.1.2/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Linux',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2024-04-26 17:52:18'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="https://cdn1.tianli0.top/npm/element-ui@2.15.6/packages/theme-chalk/lib/index.css"><style id="themeColor"></style><style id="rightSide"></style><style id="transPercent"></style><style id="blurNum"></style><style id="settingStyle"></style><span id="fps"></span><style id="defineBg"></style><style id="menu_shadow"></style><svg aria-hidden="true" style="position:absolute; overflow:hidden; width:0; height:0"><symbol id="icon-sun" viewBox="0 0 1024 1024"><path d="M960 512l-128 128v192h-192l-128 128-128-128H192v-192l-128-128 128-128V192h192l128-128 128 128h192v192z" fill="#FFD878" p-id="8420"></path><path d="M736 512a224 224 0 1 0-448 0 224 224 0 1 0 448 0z" fill="#FFE4A9" p-id="8421"></path><path d="M512 109.248L626.752 224H800v173.248L914.752 512 800 626.752V800h-173.248L512 914.752 397.248 800H224v-173.248L109.248 512 224 397.248V224h173.248L512 109.248M512 64l-128 128H192v192l-128 128 128 128v192h192l128 128 128-128h192v-192l128-128-128-128V192h-192l-128-128z" fill="#4D5152" p-id="8422"></path><path d="M512 320c105.888 0 192 86.112 192 192s-86.112 192-192 192-192-86.112-192-192 86.112-192 192-192m0-32a224 224 0 1 0 0 448 224 224 0 0 0 0-448z" fill="#4D5152" p-id="8423"></path></symbol><symbol id="icon-moon" viewBox="0 0 1024 1024"><path d="M611.370667 167.082667a445.013333 445.013333 0 0 1-38.4 161.834666 477.824 477.824 0 0 1-244.736 244.394667 445.141333 445.141333 0 0 1-161.109334 38.058667 85.077333 85.077333 0 0 0-65.066666 135.722666A462.08 462.08 0 1 0 747.093333 102.058667a85.077333 85.077333 0 0 0-135.722666 65.024z" fill="#FFB531" p-id="11345"></path><path d="M329.728 274.133333l35.157333-35.157333a21.333333 21.333333 0 1 0-30.165333-30.165333l-35.157333 35.157333-35.114667-35.157333a21.333333 21.333333 0 0 0-30.165333 30.165333l35.114666 35.157333-35.114666 35.157334a21.333333 21.333333 0 1 0 30.165333 30.165333l35.114667-35.157333 35.157333 35.157333a21.333333 21.333333 0 1 0 30.165333-30.165333z" fill="#030835" p-id="11346"></path></symbol></svg><!-- hexo injector head_end start --><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/font-awesome-animation.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/tag_plugins.css" media="defer" onload="this.media='all'"><script src="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/carousel-touch.js"></script><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload="this.media='screen'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-filter-gitcalendar/lib/gitcalendar.css" media="print" onload="this.media='all'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.3.0"><link rel="alternate" href="/atom.xml" title="XiaoFei🥝" type="application/atom+xml">
</head><body><div id="loading-box" onclick="document.getElementById(&quot;loading-box&quot;).classList.add(&quot;loaded&quot;)"><div class="loading-bg"><div class="loading-img"></div><div class="loading-image-dot"></div></div></div><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://www.naste.top:9000/images/cat.jpg" onerror="onerror=null;src='/assets/r1.jpg'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">149</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">99</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">46</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-home"></use></svg><span class="menu_word" style="font-size:17px"> 首页</span></a></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon--article"></use></svg><span class="menu_word" style="font-size:17px"> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-guidang1">                   </use></svg><span class="menu_word" style="font-size:17px"> 归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-sekuaibiaoqian">                   </use></svg><span class="menu_word" style="font-size:17px"> 标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-fenlei">                   </use></svg><span class="menu_word" style="font-size:17px"> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-pinweishenghuo"></use></svg><span class="menu_word" style="font-size:17px"> 休闲</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/life/music/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-yinle">                   </use></svg><span class="menu_word" style="font-size:17px"> 八音盒</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/movies/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-dianying1">                   </use></svg><span class="menu_word" style="font-size:17px"> 影院</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/games/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-youxishoubing">                   </use></svg><span class="menu_word" style="font-size:17px"> 游戏</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-xiangzi"></use></svg><span class="menu_word" style="font-size:17px"> 八宝箱</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/box/gallery/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-tubiaozhizuomoban">                   </use></svg><span class="menu_word" style="font-size:17px"> 画廊</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/box/animation/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-nvwumao">                   </use></svg><span class="menu_word" style="font-size:17px"> 动画</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/box/nav/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-zhifengche">                   </use></svg><span class="menu_word" style="font-size:17px"> 网址导航</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-shejiaoxinxi"></use></svg><span class="menu_word" style="font-size:17px"> 社交</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/social/fcircle/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-pengyouquan">                   </use></svg><span class="menu_word" style="font-size:17px"> 朋友圈</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/comments/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-liuyan">                   </use></svg><span class="menu_word" style="font-size:17px"> 留言板</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/social/link/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-lianjie">                   </use></svg><span class="menu_word" style="font-size:17px"> 友人帐</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-wangye"></use></svg><span class="menu_word" style="font-size:17px"> 网站</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/site/census/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon--tongjibiao">                   </use></svg><span class="menu_word" style="font-size:17px"> 网站统计</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/site/echarts/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-shujutongji1">                   </use></svg><span class="menu_word" style="font-size:17px"> 文章统计</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/site/time/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-xianxingshalou">                   </use></svg><span class="menu_word" style="font-size:17px"> 旧时光</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-maoliang"></use></svg><span class="menu_word" style="font-size:17px"> 个人</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/personal/bb/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-qunliaotian">                   </use></svg><span class="menu_word" style="font-size:17px"> 唠叨</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/love/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-love-sign">                   </use></svg><span class="menu_word" style="font-size:17px"> 恋爱小屋</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/about/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-paperplane">                   </use></svg><span class="menu_word" style="font-size:17px"> 关于</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/encryption/%E6%9C%BA%E5%9C%BA/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-paperplane">                   </use></svg><span class="menu_word" style="font-size:17px"> 机场</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">XiaoFei🥝</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-home"></use></svg><span class="menu_word" style="font-size:17px"> 首页</span></a></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon--article"></use></svg><span class="menu_word" style="font-size:17px"> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-guidang1">                   </use></svg><span class="menu_word" style="font-size:17px"> 归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-sekuaibiaoqian">                   </use></svg><span class="menu_word" style="font-size:17px"> 标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-fenlei">                   </use></svg><span class="menu_word" style="font-size:17px"> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-pinweishenghuo"></use></svg><span class="menu_word" style="font-size:17px"> 休闲</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/life/music/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-yinle">                   </use></svg><span class="menu_word" style="font-size:17px"> 八音盒</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/movies/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-dianying1">                   </use></svg><span class="menu_word" style="font-size:17px"> 影院</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/games/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-youxishoubing">                   </use></svg><span class="menu_word" style="font-size:17px"> 游戏</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-xiangzi"></use></svg><span class="menu_word" style="font-size:17px"> 八宝箱</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/box/gallery/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-tubiaozhizuomoban">                   </use></svg><span class="menu_word" style="font-size:17px"> 画廊</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/box/animation/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-nvwumao">                   </use></svg><span class="menu_word" style="font-size:17px"> 动画</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/box/nav/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-zhifengche">                   </use></svg><span class="menu_word" style="font-size:17px"> 网址导航</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-shejiaoxinxi"></use></svg><span class="menu_word" style="font-size:17px"> 社交</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/social/fcircle/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-pengyouquan">                   </use></svg><span class="menu_word" style="font-size:17px"> 朋友圈</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/comments/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-liuyan">                   </use></svg><span class="menu_word" style="font-size:17px"> 留言板</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/social/link/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-lianjie">                   </use></svg><span class="menu_word" style="font-size:17px"> 友人帐</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-wangye"></use></svg><span class="menu_word" style="font-size:17px"> 网站</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/site/census/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon--tongjibiao">                   </use></svg><span class="menu_word" style="font-size:17px"> 网站统计</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/site/echarts/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-shujutongji1">                   </use></svg><span class="menu_word" style="font-size:17px"> 文章统计</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/site/time/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-xianxingshalou">                   </use></svg><span class="menu_word" style="font-size:17px"> 旧时光</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-maoliang"></use></svg><span class="menu_word" style="font-size:17px"> 个人</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/personal/bb/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-qunliaotian">                   </use></svg><span class="menu_word" style="font-size:17px"> 唠叨</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/love/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-love-sign">                   </use></svg><span class="menu_word" style="font-size:17px"> 恋爱小屋</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/about/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-paperplane">                   </use></svg><span class="menu_word" style="font-size:17px"> 关于</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/encryption/%E6%9C%BA%E5%9C%BA/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-paperplane">                   </use></svg><span class="menu_word" style="font-size:17px"> 机场</span></a></li></ul></div></div><center id="name-container"><a id="page-name" href="javascript:scrollToTop()">PAGE_NAME</a></center><div id="nav-right"><div id="search-button"><a class="search faa-parent animated-hover" title="检索站内任何你想要的信息"><svg class="faa-tada icon" style="height:24px;width:24px;fill:currentColor;position:relative;top:6px" aria-hidden="true"><use xlink:href="#icon-valentine_-search-love-find-heart"></use></svg><span> 搜索</span></a></div><a class="meihua faa-parent animated-hover" onclick="toggleWinbox()" title="美化设置-自定义你的风格" id="meihua-button"><svg class="faa-tada icon" style="height:26px;width:26px;fill:currentColor;position:relative;top:8px" aria-hidden="true"><use xlink:href="#icon-tupian1"></use></svg></a><a class="sun_moon faa-parent animated-hover" onclick="switchNightMode()" title="浅色和深色模式转换" id="nightmode-button"><svg class="faa-tada" style="height:25px;width:25px;fill:currentColor;position:relative;top:7px" viewBox="0 0 1024 1024"><use id="modeicon" xlink:href="#icon-moon">       </use></svg></a><div id="toggle-menu"><a><i class="fas fa-bars fa-fw"></i></a></div></div></div></nav><div id="post-info"><h1 class="post-title">Linux</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><svg class="meta_icon post-meta-icon" style="width:30px;height:30px;position:relative;top:10px"><use xlink:href="#icon-rili"></use></svg><span class="post-meta-label">发表于 </span><time class="post-meta-date-created" datetime="2022-07-04T10:01:02.000Z" title="发表于 2022-07-04 18:01:02">2022-07-04</time><span class="post-meta-separator">|</span><svg class="meta_icon post-meta-icon" style="width:18px;height:18px;position:relative;top:5px"><use xlink:href="#icon-gengxin1"></use></svg><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-04-26T09:52:18.526Z" title="更新于 2024-04-26 17:52:18">2024-04-26</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><svg class="meta_icon post-meta-icon" style="width:18px;height:18px;position:relative;top:5px"><use xlink:href="#icon-biaoqian"></use></svg><a class="post-meta-categories" href="/categories/Linux/">Linux</a><i class="fas fa-angle-right post-meta-separator"></i><svg class="meta_icon post-meta-icon" style="width:18px;height:18px;position:relative;top:5px"><use xlink:href="#icon-biaoqian"></use></svg><a class="post-meta-categories" href="/categories/Linux/Linux%E4%BD%BF%E7%94%A8/">Linux使用</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><svg class="meta_icon post-meta-icon" style="width:25px;height:25px;position:relative;top:8px"><use xlink:href="#icon-charuword"></use></svg><span class="post-meta-label">字数总计:</span><span class="word-count">1.2w</span><span class="post-meta-separator">|</span><svg class="meta_icon post-meta-icon" style="width:20px;height:20px;position:relative;top:5px"><use xlink:href="#icon-shizhong"></use></svg><span class="post-meta-label">阅读时长:</span><span>41分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Linux"><svg class="meta_icon post-meta-icon" style="width:25px;height:25px;position:relative;top:5px"><use xlink:href="#icon-eye"></use></svg><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div><section class="main-hero-waves-area waves-area"><svg class="waves-svg" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"><defs><path id="gentle-wave" d="M -160 44 c 30 0 58 -18 88 -18 s 58 18 88 18 s 58 -18 88 -18 s 58 18 88 18 v 44 h -352 Z"></path></defs><g class="parallax"><use href="#gentle-wave" x="48" y="0"></use><use href="#gentle-wave" x="48" y="3"></use><use href="#gentle-wave" x="48" y="5"></use><use href="#gentle-wave" x="48" y="7"></use></g></svg></section></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="Linux文件与目录结构"><a href="#Linux文件与目录结构" class="headerlink" title="Linux文件与目录结构"></a>Linux文件与目录结构</h1><ul>
<li>bin<ul>
<li>是Binary的缩写，这个目录存放着经常使用的命令</li>
</ul>
</li>
<li>sbin<ul>
<li>s就是Super User的意思，这里存放的是系统管理员使用的系统管理程序</li>
</ul>
</li>
<li>home<ul>
<li>存放普通用户的目录，在Linux中，每个用户都有一个自己的目录，一般该目录是以用户的账号命名的</li>
</ul>
</li>
<li>root<ul>
<li>该目录为系统管理员，也称做超级权限的用户主目录</li>
</ul>
</li>
<li>lib<ul>
<li>系统开机所需要最基本的动态连接共享库，其作用类似于Windows里的DLL文件，几乎所有的应用程序都要用到这些共享库</li>
</ul>
</li>
<li>lost + found<ul>
<li>这个目录一般情况下是空的，当系统非法关机后，这里就存放了一些文件</li>
</ul>
</li>
<li>etc<ul>
<li>所有的系统管理员所需要的配置文件和子目录</li>
</ul>
</li>
<li>usr<ul>
<li>这是一个非常重要的目录，用户的很多应用程序和文件都要放在这个目录下，类似于Windows下的program files目录</li>
</ul>
</li>
<li>boot<ul>
<li>这里存放的是启动Linux时使用的一些核心文件，包括一些连接文件以及镜像文件，自己的安装别放这里</li>
</ul>
</li>
<li>proc<ul>
<li>这个目录是一个虚拟目录，它是系统内存映射，我们可以通过直接访问这个目录来获取系统信息</li>
</ul>
</li>
<li>src<ul>
<li>service缩写，该目录用来存放一些服务启动之后需要提取的数据</li>
</ul>
</li>
<li>sys<ul>
<li>这是Linux2.6内核的一个很大的变化，该目录下面安装了2，6内核中新出现的一个文件系统sysfs</li>
</ul>
</li>
<li>tmp<ul>
<li>这个目录用来存放一些临时文件的</li>
</ul>
</li>
<li>dev<ul>
<li>类似于Windows的设备管理器，把所有的硬件用文件的形式存储</li>
</ul>
</li>
<li>media（CentOS6）<ul>
<li>Linux系统会自动识别一些设备，例如U盘，光驱，当识别后，Linux会把识别的设备挂载到这个目录下</li>
<li>CentOS7迁移到/run/media</li>
</ul>
</li>
<li>mnt<ul>
<li>系统提供该目录是为了让用户临时挂载别的文件系统，我们可以将外部的存储挂载在mnt上，然后进入该目录就可以看到里面的内容了</li>
</ul>
</li>
<li>opt<ul>
<li>这是给主机额外安装软件所摆放的目录。比如安装一个MySQL数据库就可以放到这个目录下，默认是空的</li>
</ul>
</li>
<li>var<ul>
<li>这个目录中存放着在不断扩充着的东西，我们习惯将那些经常被修改的目录放在这个目录下，包括各种日志文件</li>
</ul>
</li>
</ul>
<h1 id="VI-VM编辑器"><a href="#VI-VM编辑器" class="headerlink" title="VI/VM编辑器"></a>VI/VM编辑器</h1><h2 id="使用vim打开一个文本文件进行编辑"><a href="#使用vim打开一个文本文件进行编辑" class="headerlink" title="使用vim打开一个文本文件进行编辑"></a>使用vim打开一个文本文件进行编辑</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim test.txt</span><br></pre></td></tr></table></figure>
<h2 id="一般模式"><a href="#一般模式" class="headerlink" title="一般模式"></a>一般模式</h2><div class="table-container">
<table>
<thead>
<tr>
<th>语法</th>
<th>功能描述</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>yy</td>
<td>复制光标所在行的文字</td>
<td>yy</td>
</tr>
<tr>
<td>y 数字y</td>
<td>复制光标所在行的文字及后面的指定几行文字</td>
<td>y3y</td>
</tr>
<tr>
<td>p</td>
<td>将文字粘贴到光标后</td>
<td>p</td>
</tr>
<tr>
<td>u</td>
<td>撤销</td>
<td>u</td>
</tr>
<tr>
<td>dd</td>
<td>删除光标所在行</td>
<td>dd</td>
</tr>
<tr>
<td>d 数字  d</td>
<td>删除光标（含）后多少行【例如：d1d删除光标所在行，d2d删除光标所在行及光标后一行】</td>
<td>d 3 d</td>
</tr>
<tr>
<td>x（小x）</td>
<td>剪切光标所指字母</td>
<td>x</td>
</tr>
<tr>
<td>X（大X）</td>
<td>剪切光标所指之母的前一个字母</td>
<td>X</td>
</tr>
<tr>
<td>yw</td>
<td>复制一个词</td>
<td>yw</td>
</tr>
<tr>
<td>dw</td>
<td>删除一个词</td>
<td>dw</td>
</tr>
<tr>
<td>shift + 6(^)</td>
<td>光标移动到行头</td>
<td>shift + 6(^)</td>
</tr>
<tr>
<td>shift + 4($)</td>
<td>光标移动到行尾</td>
<td>shift + 4($)</td>
</tr>
<tr>
<td>1 + shift + g</td>
<td>光标移动到第一行的头</td>
<td>1 + shift + g</td>
</tr>
<tr>
<td>shift + g</td>
<td>光标移动到最后一行的头</td>
<td>shift + g</td>
</tr>
<tr>
<td>数字 + shift + g</td>
<td>移动到目标行</td>
<td>数字 + shift + g</td>
</tr>
</tbody>
</table>
</div>
<h2 id="编辑模式"><a href="#编辑模式" class="headerlink" title="编辑模式"></a>编辑模式</h2><div class="table-container">
<table>
<thead>
<tr>
<th>按键</th>
<th>进入编辑模式之后光标所在位置</th>
</tr>
</thead>
<tbody>
<tr>
<td>i</td>
<td>当前光标钱</td>
</tr>
<tr>
<td>a</td>
<td>当前光标后</td>
</tr>
<tr>
<td>o</td>
<td>当前光标的下一行</td>
</tr>
<tr>
<td>I</td>
<td>光标所在行最前</td>
</tr>
<tr>
<td>A</td>
<td>光标所在行最后</td>
</tr>
<tr>
<td>O</td>
<td>光标所在行的上一行</td>
</tr>
</tbody>
</table>
</div>
<h2 id="退出编辑"><a href="#退出编辑" class="headerlink" title="退出编辑"></a>退出编辑</h2><p><strong>按<code>Esc</code>键退出编辑模式，之后所在的模式为一般模式</strong></p>
<h2 id="指定模式"><a href="#指定模式" class="headerlink" title="指定模式"></a>指定模式</h2><div class="table-container">
<table>
<thead>
<tr>
<th>命令</th>
<th>功能</th>
<th>例如</th>
</tr>
</thead>
<tbody>
<tr>
<td>:w</td>
<td>保存</td>
<td></td>
</tr>
<tr>
<td>:q</td>
<td>退出</td>
<td></td>
</tr>
<tr>
<td>:wq</td>
<td>强制保存退出</td>
<td></td>
</tr>
<tr>
<td>:q!</td>
<td>强制退出</td>
<td></td>
</tr>
<tr>
<td>:!</td>
<td>强制执行</td>
<td></td>
</tr>
<tr>
<td>/要查找的词</td>
<td>n查找下一个，N往上查找</td>
<td></td>
</tr>
<tr>
<td>:noh</td>
<td>取消高亮显示</td>
<td></td>
</tr>
<tr>
<td>:set nu</td>
<td>显示行号</td>
<td></td>
</tr>
<tr>
<td>:set nonu</td>
<td>关闭行号</td>
<td></td>
</tr>
<tr>
<td>:%s/old/new/g</td>
<td>替换内容 /g 替换匹配到的所有内容</td>
<td>:%s/好/在/g</td>
</tr>
</tbody>
</table>
</div>
<h2 id="模式间转换"><a href="#模式间转换" class="headerlink" title="模式间转换"></a>模式间转换</h2><p><img src= "" data-lazy-src="https://www.naste.top:9000/webp/image-20220604101559716.webp" alt="image-20220604101559716"></p>
<h1 id="网络配置"><a href="#网络配置" class="headerlink" title="网络配置"></a>网络配置</h1><h2 id="VMware使用桥接网络"><a href="#VMware使用桥接网络" class="headerlink" title="VMware使用桥接网络"></a>VMware使用桥接网络</h2><p><strong>为客户机操作系统提供直接访问外部以太网网络的权限。客户机在外部网络上必须有自己的P地址。</strong></p>
<p><strong>使用桥接网络的弊端，当宿主机没有连接网络的时候，虚拟机将会没有ip</strong></p>
<h3 id="ifconfig查看Linux的ip地址"><a href="#ifconfig查看Linux的ip地址" class="headerlink" title="ifconfig查看Linux的ip地址"></a>ifconfig查看Linux的ip地址</h3><p><strong>输入<code>ifconfig</code>之后，可以看到<code>ens33</code>的下面后一个<code>inet</code>后面有一个<code>ipv4</code>的地址，该值一般都是<code>192.168</code>开头的</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line">[root@xiaofei /]# ifconfig</span><br><span class="line">ens33: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500</span><br><span class="line">        inet 192.168.123.143  netmask 255.255.255.0  broadcast 192.168.123.255</span><br><span class="line">        inet6 fd43:f8ec:c3da::a1e  prefixlen 128  scopeid 0x0&lt;global&gt;</span><br><span class="line">        inet6 fd43:f8ec:c3da:0:5b6b:9933:68ee:c7c5  prefixlen 64  scopeid 0x0&lt;global&gt;</span><br><span class="line">        inet6 fe80::41c3:9ffa:c776:8def  prefixlen 64  scopeid 0x20&lt;link&gt;</span><br><span class="line">        ether 00:0c:29:7a:63:41  txqueuelen 1000  (Ethernet)</span><br><span class="line">        RX packets 2539  bytes 240141 (234.5 KiB)</span><br><span class="line">        RX errors 0  dropped 0  overruns 0  frame 0</span><br><span class="line">        TX packets 1839  bytes 362152 (353.6 KiB)</span><br><span class="line">        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</span><br><span class="line"></span><br><span class="line">lo: flags=73&lt;UP,LOOPBACK,RUNNING&gt;  mtu 65536</span><br><span class="line">        inet 127.0.0.1  netmask 255.0.0.0</span><br><span class="line">        inet6 ::1  prefixlen 128  scopeid 0x10&lt;host&gt;</span><br><span class="line">        loop  txqueuelen 1000  (Local Loopback)</span><br><span class="line">        RX packets 32  bytes 2592 (2.5 KiB)</span><br><span class="line">        RX errors 0  dropped 0  overruns 0  frame 0</span><br><span class="line">        TX packets 32  bytes 2592 (2.5 KiB)</span><br><span class="line">        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</span><br><span class="line"></span><br><span class="line">virbr0: flags=4099&lt;UP,BROADCAST,MULTICAST&gt;  mtu 1500</span><br><span class="line">        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255</span><br><span class="line">        ether 52:54:00:05:25:bc  txqueuelen 1000  (Ethernet)</span><br><span class="line">        RX packets 0  bytes 0 (0.0 B)</span><br><span class="line">        RX errors 0  dropped 0  overruns 0  frame 0</span><br><span class="line">        TX packets 0  bytes 0 (0.0 B)</span><br><span class="line">        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</span><br></pre></td></tr></table></figure>
<h3 id="ifconfig看不到ip地址"><a href="#ifconfig看不到ip地址" class="headerlink" title="ifconfig看不到ip地址"></a>ifconfig看不到ip地址</h3><h4 id="方法一"><a href="#方法一" class="headerlink" title="方法一"></a>方法一</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第一步：进入IP配置文件将ONBOOT的值设置为<span class="literal">true</span>（下图截图部分）</span></span><br><span class="line">vim /etc/sysconfig/network-scripts/ifcfg-ens33</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第二步：刷新网卡</span></span><br><span class="line">service network restart</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看IP地址</span></span><br><span class="line">ifconfig</span><br></pre></td></tr></table></figure>
<p><img src= "" data-lazy-src="https://www.naste.top:9000/webp/image-20220604103057780.webp" alt="image-20220604103057780"></p>
<h4 id="方法二"><a href="#方法二" class="headerlink" title="方法二"></a>方法二</h4><p><strong>如果方法一不生效可以尝试方法二</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第一步</span></span><br><span class="line">ifup ens33启动网卡（此处ens33不固定，根据自己的网卡更改）出现Connection successfully activated时说明网卡启动成功，</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第二步</span></span><br><span class="line">ifconfig</span><br></pre></td></tr></table></figure>
<h2 id="VMware使用NATA模式"><a href="#VMware使用NATA模式" class="headerlink" title="VMware使用NATA模式"></a>VMware使用NATA模式</h2><blockquote>
<p><strong>设置静态IP，如果是虚拟机克隆的，需要修改服务器的<code>hostname</code>，设置命令为<code>hostnamectl set-hostname 新主机名</code>，然后还需要修改下面的网络配置，<code>UUID</code>和<code>IPADDR</code>不能一样，然后重启机器</strong></p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line">TYPE=&quot;Ethernet&quot;</span><br><span class="line">PROXY_METHOD=&quot;none&quot;</span><br><span class="line">BROWSER_ONLY=&quot;no&quot;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">IP 的配置方法[none|static|bootp|dhcp]（引导时不使用协议|静态 分配 IP|BOOTP 协议|DHCP 协议）</span> </span><br><span class="line">BOOTPROTO=&quot;none&quot;</span><br><span class="line">DEFROUTE=&quot;yes&quot;</span><br><span class="line">IPV4_FAILURE_FATAL=&quot;no&quot;</span><br><span class="line">IPV6INIT=&quot;yes&quot;</span><br><span class="line">IPV6_AUTOCONF=&quot;yes&quot;</span><br><span class="line">IPV6_DEFROUTE=&quot;yes&quot;</span><br><span class="line">IPV6_FAILURE_FATAL=&quot;no&quot;</span><br><span class="line">IPV6_ADDR_GEN_MODE=&quot;stable-privacy&quot;</span><br><span class="line">NAME=&quot;ens33&quot;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">UUID，每一台的机器的UUID不能一样</span></span><br><span class="line">UUID=&quot;f188900d-073a-433f-8ed0-202befb34a8e&quot;</span><br><span class="line">DEVICE=&quot;ens33&quot;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开机启动</span></span><br><span class="line">ONBOOT=&quot;yes&quot;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">静态IP</span></span><br><span class="line">IPADDR=&quot;192.168.40.40&quot;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">子网掩码</span></span><br><span class="line">PREFIX=&quot;24&quot;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">网关</span></span><br><span class="line">GATEWAY=&quot;192.168.40.2&quot;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">DNS地址</span></span><br><span class="line">DNS1=&quot;114.114.114.114&quot;</span><br><span class="line">DNS2=&quot;8.8.8.8&quot;</span><br><span class="line">IPV6_PRIVACY=&quot;no&quot;</span><br></pre></td></tr></table></figure>
<h2 id="ifconfig没有eth0"><a href="#ifconfig没有eth0" class="headerlink" title="ifconfig没有eth0"></a>ifconfig没有eth0</h2><p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/tim1blog/p/9887629.html">https://www.cnblogs.com/tim1blog/p/9887629.html</a></p>
<h1 id="系统管理"><a href="#系统管理" class="headerlink" title="系统管理"></a>系统管理</h1><h2 id="Linux中的进程和服务"><a href="#Linux中的进程和服务" class="headerlink" title="Linux中的进程和服务"></a>Linux中的进程和服务</h2><ul>
<li>计算机中，一个正在执行的程序或命令，被叫做“进程”（process）。</li>
<li>启动之后一只存在、常驻内存的进程，一般被称作“服务”（service）。</li>
</ul>
<h2 id="service-服务管理（CentOS-6版本-了解）"><a href="#service-服务管理（CentOS-6版本-了解）" class="headerlink" title="service 服务管理（CentOS 6版本-了解）"></a>service 服务管理（CentOS 6版本-了解）</h2><h3 id="基本语法"><a href="#基本语法" class="headerlink" title="基本语法"></a>基本语法</h3><figure class="highlight coq"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">service 服务名 start | <span class="type">stop</span> | <span class="type">restart</span> | <span class="type">status</span></span><br></pre></td></tr></table></figure>
<h3 id="查看服务"><a href="#查看服务" class="headerlink" title="查看服务"></a>查看服务</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第一步</span></span><br><span class="line">cd /etc/init.d/</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第二步</span></span><br><span class="line">ls -al</span><br></pre></td></tr></table></figure>
<h3 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看网络状态</span></span><br><span class="line">service nerwork status</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">停止网络服务</span></span><br><span class="line">service nerwork stop</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启动网络服务</span></span><br><span class="line">service nerwork start</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">重启网络服务</span></span><br><span class="line">service nerwork restart</span><br></pre></td></tr></table></figure>
<h2 id="chkconfig-设置后台服务的自启配置（CentOS-6版本）"><a href="#chkconfig-设置后台服务的自启配置（CentOS-6版本）" class="headerlink" title="chkconfig 设置后台服务的自启配置（CentOS 6版本）"></a>chkconfig 设置后台服务的自启配置（CentOS 6版本）</h2><h3 id="基本语法-1"><a href="#基本语法-1" class="headerlink" title="基本语法"></a>基本语法</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看所有服务器自动启动配置</span></span><br><span class="line">chkconfig</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">关掉指定服务的自动启动</span></span><br><span class="line">chkconfig 服务名 off</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启指定服务的自动启动</span></span><br><span class="line">chkconfig 服务名 on</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看服务开机启动状态</span></span><br><span class="line">chkconfig 服务名 --list</span><br></pre></td></tr></table></figure>
<h3 id="使用-1"><a href="#使用-1" class="headerlink" title="使用"></a>使用</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启 / 关闭 network（网络）服务的自动启动</span></span><br><span class="line">chkconfig network on</span><br><span class="line">chkconfig network off</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启 / 关闭network服务指定级别的自动启动</span></span><br><span class="line">chkconfig --level 指定级别 network on</span><br><span class="line">chkconfig --level 指定级别 network off</span><br></pre></td></tr></table></figure>
<h2 id="systemctl（CentOS7版本-重点掌握）"><a href="#systemctl（CentOS7版本-重点掌握）" class="headerlink" title="systemctl（CentOS7版本-重点掌握）"></a>systemctl（CentOS7版本-重点掌握）</h2><h3 id="基本语法-2"><a href="#基本语法-2" class="headerlink" title="基本语法"></a>基本语法</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl start | stop | restart | status 服务名</span><br></pre></td></tr></table></figure>
<h3 id="查看服务-1"><a href="#查看服务-1" class="headerlink" title="查看服务"></a>查看服务</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第一步：进入system目录</span></span><br><span class="line">cd /usr/lib/systemd/system</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第二步：查看服务</span></span><br><span class="line">ls -al</span><br></pre></td></tr></table></figure>
<h3 id="使用-2"><a href="#使用-2" class="headerlink" title="使用"></a>使用</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看防火墙状态</span></span><br><span class="line">systemctl status firewalld</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">停止防火墙服务</span></span><br><span class="line">systemctl stop firewalld</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">启动防火墙服务</span></span><br><span class="line">systemctl start firewalld</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">重启防火墙服务</span></span><br><span class="line">systemctl restart firewalld</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">关闭防火墙的开机自动启动</span></span><br><span class="line">systemctl disable firewalld.service</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启防火墙的开机自动启动</span></span><br><span class="line">systemctl enable firealld.service</span><br></pre></td></tr></table></figure>
<h2 id="sysatemetl设置后台服务的自动配置"><a href="#sysatemetl设置后台服务的自动配置" class="headerlink" title="sysatemetl设置后台服务的自动配置"></a>sysatemetl设置后台服务的自动配置</h2><h3 id="基本语法-3"><a href="#基本语法-3" class="headerlink" title="基本语法"></a>基本语法</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看服务开机启动状态</span></span><br><span class="line">systemctl list-unit-files</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">关掉指定服务的自动启动</span></span><br><span class="line">systemctl disable 服务名字</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启指定服务的自动启动</span></span><br><span class="line">systemctl enable 服务名字</span><br></pre></td></tr></table></figure>
<h3 id="使用-3"><a href="#使用-3" class="headerlink" title="使用"></a>使用</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">关闭防火墙的开机自动启动</span></span><br><span class="line">systemctl disable firewalld.service</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启防火墙的开机自动启动</span></span><br><span class="line">systemctl enable firealld.service</span><br></pre></td></tr></table></figure>
<h2 id="系统运行级别"><a href="#系统运行级别" class="headerlink" title="系统运行级别"></a>系统运行级别</h2><h3 id="Linux系统的运行级别"><a href="#Linux系统的运行级别" class="headerlink" title="Linux系统的运行级别"></a>Linux系统的运行级别</h3><blockquote>
<p><strong>Linux系统的七种运行级别<code>【常用的级别是3和5】</code></strong></p>
</blockquote>
<p>运行级别0：系统停机状态，系统默认运行级别不能设为0，否则不能正常启动</p>
<p>运行级别1：单用户工作状态，root权限，用于系统维护，禁止远程登陆</p>
<p>运行级别2：多用户状态(没有NFS)，不支持网络</p>
<p>运行级别3：完全的多用户状态(有NFS)，登陆后进入控制台命令行模式</p>
<p>运行级别4：系统未使用，保留</p>
<p>运行级别5：x11控制台，登陆后进入图形GUl模式</p>
<p>运行级别6：系统正常关闭并重启，默认运行级别不能设为6，否则不能正常启动</p>
<h3 id="CentOS7的运行级别简化为"><a href="#CentOS7的运行级别简化为" class="headerlink" title="CentOS7的运行级别简化为"></a>CentOS7的运行级别简化为</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">multi-user.target：等价于原运行级别 3（多用户有网，无图形界面）</span><br><span class="line"></span><br><span class="line">graphical.target：等价于原运行级别 5（多用户有网，有图形界面）</span><br></pre></td></tr></table></figure>
<h3 id="查看当前的运行级别"><a href="#查看当前的运行级别" class="headerlink" title="查看当前的运行级别"></a>查看当前的运行级别</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl get-default</span><br></pre></td></tr></table></figure>
<h3 id="修改当前系统的运行级别"><a href="#修改当前系统的运行级别" class="headerlink" title="修改当前系统的运行级别"></a>修改当前系统的运行级别</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">（这里的`TARGET`取`multi-user`或`graphical`）</span><br><span class="line">systemctl set-default TARGET.target </span><br></pre></td></tr></table></figure>
<h2 id="关闭防火墙"><a href="#关闭防火墙" class="headerlink" title="关闭防火墙"></a>关闭防火墙</h2><h3 id="临时关闭防火墙"><a href="#临时关闭防火墙" class="headerlink" title="临时关闭防火墙"></a>临时关闭防火墙</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看防火墙状态</span></span><br><span class="line">systemctl status firewalld</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">临时关闭防火墙</span></span><br><span class="line">systemctl stop firewalld</span><br></pre></td></tr></table></figure>
<h3 id="开机启动时关闭防火墙"><a href="#开机启动时关闭防火墙" class="headerlink" title="开机启动时关闭防火墙"></a>开机启动时关闭防火墙</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看防火墙开机启动状态</span></span><br><span class="line">systemctl status firewalld.service</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机启动防火墙</span></span><br><span class="line">systemctl enable firewalld.service</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置开机时启动防火墙</span></span><br><span class="line">systemctl disable firewalld.service</span><br></pre></td></tr></table></figure>
<h2 id="开放指定端口"><a href="#开放指定端口" class="headerlink" title="开放指定端口"></a>开放指定端口</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启防火墙</span></span><br><span class="line">systemctl start firewalld</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开放指定端口</span></span><br><span class="line">firewall-cmd --zone=public --add-port=8080/tcp --permanent</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">关闭指定端口</span></span><br><span class="line">firewall-cmd --zone=public --remove-port=8080/tcp --permanent</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">命令含义：</span></span><br><span class="line">--zone #作用域</span><br><span class="line">--add-port=8080/tcp #添加端口，格式为：端口/通讯协议</span><br><span class="line">--permanent #永久生效，没有此参数重启后失效</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">重启防火墙</span></span><br><span class="line">firewall-cmd --reload</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看端口号，查看当前所有tcp端口·</span></span><br><span class="line">firewall-cmd --list-ports</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看所有端口使用情况【netstat: 未找到命令：yum -y install net-tools】</span></span><br><span class="line">netstat -ntlp</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">使用netstat查看所有8080端口使用情况并查看PID·</span></span><br><span class="line">netstat -ntulp | grep 8080</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">使用 lsof 查看所有8080端口使用情况并查看PID·【lsof: 未找到命令：yum -y install lsof】</span></span><br><span class="line">lsof -i :端口</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">杀死进程</span></span><br><span class="line">kill -9 PID</span><br></pre></td></tr></table></figure>
<h2 id="开关机命令"><a href="#开关机命令" class="headerlink" title="开关机命令"></a>开关机命令</h2><h3 id="基本语法-4"><a href="#基本语法-4" class="headerlink" title="基本语法"></a>基本语法</h3><ul>
<li>基本使用</li>
</ul>
<div class="table-container">
<table>
<thead>
<tr>
<th>命令</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>sync</td>
<td>将数据由内存同步到硬盘中</td>
</tr>
<tr>
<td>halt</td>
<td>停机，关闭系统，但不断电</td>
</tr>
<tr>
<td>poweroff</td>
<td>关机，断电</td>
</tr>
<tr>
<td>reboot</td>
<td>就是重启，等同于 shutdown -r now</td>
</tr>
</tbody>
</table>
</div>
<ul>
<li>shutdown使用</li>
</ul>
<figure class="highlight arduino"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">格式：shutdown [选项] 时间</span><br></pre></td></tr></table></figure>
<div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-H</td>
<td>相当于—halt，停机</td>
</tr>
<tr>
<td>-r</td>
<td>-r=reboot 重启</td>
</tr>
<tr>
<td>now</td>
<td>立刻关机</td>
</tr>
<tr>
<td>时间</td>
<td>等待多久后关机（时间单位是分钟）</td>
</tr>
</tbody>
</table>
</div>
<h3 id="经验技巧"><a href="#经验技巧" class="headerlink" title="经验技巧"></a>经验技巧</h3><p>Linux 系统中为了提高磁盘的读写效率，对磁盘采取了 “预读迟写”操作方式。当用户保存文件</p>
<p>时，Linux 核心并不一定立即将保存数据写入物理磁盘中，而是将数据保存在缓冲区中，等缓</p>
<p>冲区满时再写入磁盘，这种方式可以极大的提高磁盘写入数据的效率。但是，也带来了安全隐</p>
<p>患，如果数据还未写入磁盘时，系统掉电或者其他严重问题出现，则将导致数据丢失。使用 </p>
<p>sync 指令可以立即将缓冲区的数据写入磁盘。</p>
<h3 id="使用-4"><a href="#使用-4" class="headerlink" title="使用"></a>使用</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">将数据由内存同步到硬盘中</span></span><br><span class="line">sync</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">重启</span></span><br><span class="line">reboot</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">停机（不断电）</span></span><br><span class="line">halt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">计算机将在1分钟后关机，并且会现在登录用户的当前屏幕中</span></span><br><span class="line">shutdown -h now</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">立马关机（等同于 poweroff）</span></span><br><span class="line">shutdown -h now</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">系统立马重启（等同于 reboot）</span></span><br><span class="line">shutdown -r now</span><br></pre></td></tr></table></figure>
<h1 id="常用基本命令（重要）"><a href="#常用基本命令（重要）" class="headerlink" title="常用基本命令（重要）"></a>常用基本命令（重要）</h1><h2 id="帮助命令"><a href="#帮助命令" class="headerlink" title="帮助命令"></a>帮助命令</h2><h3 id="man获得帮助信息"><a href="#man获得帮助信息" class="headerlink" title="man获得帮助信息"></a>man获得帮助信息</h3><h4 id="基本语法-5"><a href="#基本语法-5" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">man [命令或配置文件] （功能描述：获得帮助信息）</span><br></pre></td></tr></table></figure>
<h4 id="显示说明"><a href="#显示说明" class="headerlink" title="显示说明"></a>显示说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>信息</th>
<th>选项</th>
</tr>
</thead>
<tbody>
<tr>
<td>NAME</td>
<td>命令的名称和单行描述</td>
</tr>
<tr>
<td>SYNOPSIS</td>
<td>怎样使用命令</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>命令功能的深入讨论</td>
</tr>
<tr>
<td>EXAMPLES</td>
<td>怎样使用命令的例子</td>
</tr>
<tr>
<td>SEE ALSO</td>
<td>相关主题（通常是手册页）</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-5"><a href="#使用-5" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看 <span class="built_in">ls</span> 命令的帮助信息</span></span><br><span class="line">mal ls</span><br></pre></td></tr></table></figure>
<h3 id="help-获得-shell-内置命令的帮助信息"><a href="#help-获得-shell-内置命令的帮助信息" class="headerlink" title="help 获得 shell 内置命令的帮助信息"></a><strong>help</strong> <strong>获得</strong> <strong>shell</strong> <strong>内置命令的帮助信息</strong></h3><p>一部分基础功能的系统命令是直接内嵌在 shell 中的，系统加载启动之后会随着 shell 一起加载，常驻系统内存中。这部分命令被称为“内置（built-in）命令”；相应的其它命令 被称为“外部命令”。 </p>
<h4 id="基本语法-6"><a href="#基本语法-6" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight stata"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">help</span> 命令（功能描述：获得 <span class="keyword">shell</span> 内置命令的帮助信息）</span><br></pre></td></tr></table></figure>
<h4 id="使用-6"><a href="#使用-6" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看 <span class="built_in">cd</span> 命令的帮助信息</span></span><br><span class="line">help cd</span><br></pre></td></tr></table></figure>
<h3 id="常用快捷键"><a href="#常用快捷键" class="headerlink" title="常用快捷键"></a><strong>常用快捷键</strong></h3><div class="table-container">
<table>
<thead>
<tr>
<th>常用快捷键</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>ctrl + c</td>
<td>停止进程</td>
</tr>
<tr>
<td>ctrl+l</td>
<td>清屏，等同于 clear；彻底清屏是：reset</td>
</tr>
<tr>
<td>善于用 tab 键</td>
<td>提示(更重要的是可以防止敲错)</td>
</tr>
<tr>
<td>上下键</td>
<td>查找执行过的命令</td>
</tr>
</tbody>
</table>
</div>
<h2 id="文件目录类"><a href="#文件目录类" class="headerlink" title="文件目录类"></a>文件目录类</h2><h3 id="pwd-显示当前工作目录的绝对路径"><a href="#pwd-显示当前工作目录的绝对路径" class="headerlink" title="pwd 显示当前工作目录的绝对路径"></a><strong>pwd</strong> <strong>显示当前工作目录的绝对路径</strong></h3><p>pwd:print working directory 打印工作目录 </p>
<h4 id="基本语法-7"><a href="#基本语法-7" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前工作目录的绝对路径</span></span><br><span class="line">pwd</span><br></pre></td></tr></table></figure>
<h4 id="案例实操"><a href="#案例实操" class="headerlink" title="案例实操"></a>案例实操</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前工作目录的绝对路径</span></span><br><span class="line">pwd</span><br></pre></td></tr></table></figure>
<h3 id="ls列出目录的内容"><a href="#ls列出目录的内容" class="headerlink" title="ls列出目录的内容"></a>ls列出目录的内容</h3><p>ls：list 列出目录内容 </p>
<h4 id="基本语法-8"><a href="#基本语法-8" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls [选项] [目录或是文件]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明"><a href="#选项说明" class="headerlink" title="选项说明"></a><strong>选项说明</strong></h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-a</td>
<td>全部的文件，连同隐藏档( 开头为 . 的文件) 一起列出来(常用)</td>
</tr>
<tr>
<td>-l</td>
<td>长数据串列出，包含文件的属性与权限等等数据；(常用)等价于”ll”</td>
</tr>
</tbody>
</table>
</div>
<h4 id="显示说明-1"><a href="#显示说明-1" class="headerlink" title="显示说明"></a>显示说明</h4><p>每行列出的信息依次是： 文件类型与权限 链接数 文件属主 文件属组 文件大小用byte 来表示 建立或最近修改的时间 名字</p>
<h4 id="使用-7"><a href="#使用-7" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看当前目录的所有内容信息</span></span><br><span class="line">ls -al</span><br></pre></td></tr></table></figure>
<h3 id="cd切换目录"><a href="#cd切换目录" class="headerlink" title="cd切换目录"></a>cd切换目录</h3><p>cd：Change Directory 切换路径</p>
<h4 id="基本语法-9"><a href="#基本语法-9" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cd [参数]</span><br></pre></td></tr></table></figure>
<h4 id="参数说明"><a href="#参数说明" class="headerlink" title="参数说明"></a>参数说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>参数</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>cd 绝对路径</td>
<td>切换路径</td>
</tr>
<tr>
<td>cd 相对路径</td>
<td>切换路径</td>
</tr>
<tr>
<td>cd ~或者 cd</td>
<td>回到自己的家目录</td>
</tr>
<tr>
<td>cd -</td>
<td>回到上一次所在目录</td>
</tr>
<tr>
<td>cd ..</td>
<td>回到当前目录的上一级目录</td>
</tr>
<tr>
<td>cd -P</td>
<td>跳转到实际物理路径，而非快捷方式路径</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-8"><a href="#使用-8" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">使用绝对路径切换到 root 目录</span></span><br><span class="line">cd /root/</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">使用相对路径切换到“公共的”目录</span></span><br><span class="line">cd 公共的/</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">表示回到自己的家目录，亦即是 /root 这个目录</span></span><br><span class="line">cd ~</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="built_in">cd</span>- 回到上一次所在目录</span></span><br><span class="line">cd -</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">表示回到当前目录的上一级目录，亦即是 “/root/公共的”的上一级目录的意思；</span></span><br><span class="line">cd ..</span><br></pre></td></tr></table></figure>
<h3 id="mkdir创建一个新的目录"><a href="#mkdir创建一个新的目录" class="headerlink" title="mkdir创建一个新的目录"></a>mkdir创建一个新的目录</h3><p>mkdir:Make directory 建立目录 </p>
<h4 id="基本语法-10"><a href="#基本语法-10" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir [选项] 要创建的目录</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-1"><a href="#选项说明-1" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-p</td>
<td>创建多层目录</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-9"><a href="#使用-9" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">创建一个目录</span></span><br><span class="line">mkdir xiaofei</span><br><span class="line">mkdir xiaofei/test</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">创建一个多级目录</span></span><br><span class="line">mkdir -p test/xiaofei/test</span><br></pre></td></tr></table></figure>
<h3 id="rmdir删除一个空的目录"><a href="#rmdir删除一个空的目录" class="headerlink" title="rmdir删除一个空的目录"></a>rmdir删除一个空的目录</h3><p>rmkdir：Remove director 移除空目录</p>
<h4 id="基本语法-11"><a href="#基本语法-11" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rmdir 要删除的空目录</span><br></pre></td></tr></table></figure>
<h4 id="使用-10"><a href="#使用-10" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除一个空的文件夹</span></span><br><span class="line">rmdir xiaofei/test/xiaofei</span><br></pre></td></tr></table></figure>
<h3 id="touch-创建空文件"><a href="#touch-创建空文件" class="headerlink" title="touch 创建空文件"></a>touch 创建空文件</h3><h4 id="基本语法-12"><a href="#基本语法-12" class="headerlink" title="基本语法"></a>基本语法</h4><p>touch 文件名称 </p>
<h4 id="使用-11"><a href="#使用-11" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">创建一个文件</span></span><br><span class="line">touch /xiaofei/test.txt</span><br></pre></td></tr></table></figure>
<h3 id="cp复制文件或目录"><a href="#cp复制文件或目录" class="headerlink" title="cp复制文件或目录"></a>cp复制文件或目录</h3><h4 id="基本语法-13"><a href="#基本语法-13" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">复制<span class="built_in">source</span>文件到dest</span></span><br><span class="line">cp [选项] source dest </span><br></pre></td></tr></table></figure>
<h4 id="选项说明-2"><a href="#选项说明-2" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-r</td>
<td>递归复制整个文件夹</td>
</tr>
</tbody>
</table>
</div>
<h4 id="参数说明-1"><a href="#参数说明-1" class="headerlink" title="参数说明"></a>参数说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>参数</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>source</td>
<td>源文件</td>
</tr>
<tr>
<td>dest</td>
<td>目标文件</td>
</tr>
</tbody>
</table>
</div>
<h4 id="经验技巧-1"><a href="#经验技巧-1" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>强制覆盖不提示的方法“：<code>\cp</code></p>
<h4 id="使用-12"><a href="#使用-12" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">复制文件【将/xiaofei文件夹下面的test.txt文件复制到<span class="built_in">test</span>文件夹下面】</span></span><br><span class="line">cp /xiaofei/test.txt /test/</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">递归复制整个文件夹【将xiaofei文件夹全部复制到 /test/test下面】</span></span><br><span class="line">cp -r /xiaofei/ /test/test</span><br></pre></td></tr></table></figure>
<h3 id="rm删除文件或目录"><a href="#rm删除文件或目录" class="headerlink" title="rm删除文件或目录"></a>rm删除文件或目录</h3><h4 id="基本语法-14"><a href="#基本语法-14" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">递归删除目录中的所有内容</span></span><br><span class="line">rm [选项] deleteFile</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-3"><a href="#选项说明-3" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-r</td>
<td></td>
</tr>
<tr>
<td>-f</td>
<td>递归删除目录中所有内容强制执行删除操作，而不提示用于进行确认。</td>
</tr>
<tr>
<td>-v</td>
<td>显示指令的详细执行过程</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-13"><a href="#使用-13" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除文件</span></span><br><span class="line">rm -rf /xiaofei/test.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除文件夹及其删除文件夹中的所有东西</span></span><br><span class="line">rm -rf /xiaofei/</span><br></pre></td></tr></table></figure>
<h3 id="mv-移动文件与目录或重命名"><a href="#mv-移动文件与目录或重命名" class="headerlink" title="mv 移动文件与目录或重命名"></a>mv 移动文件与目录或重命名</h3><h4 id="基本语法-15"><a href="#基本语法-15" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">文件重命名</span></span><br><span class="line">mv oldFileName newFileName </span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">移动文件且给文件重命名</span></span><br><span class="line">mv /xiaofei/test.txt /test/a.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">移动文件不给文件重命名</span></span><br><span class="line">mv /xiaofei/test.txt /test/</span><br></pre></td></tr></table></figure>
<h3 id="cat-查看文件内容"><a href="#cat-查看文件内容" class="headerlink" title="cat 查看文件内容"></a>cat 查看文件内容</h3><p>查看文件内容，从第一行开始显示</p>
<h4 id="基本语法-16"><a href="#基本语法-16" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat [选项] 要查看的文件的名字</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-4"><a href="#选项说明-4" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>-n</td>
<td>显示所有行的行号，包括空行</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-14"><a href="#使用-14" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看文件不显示行号</span></span><br><span class="line">cat a.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看文件显示行号</span></span><br><span class="line">cat -n a.txt</span><br></pre></td></tr></table></figure>
<h3 id="more-文件内容分屏查看器"><a href="#more-文件内容分屏查看器" class="headerlink" title="more 文件内容分屏查看器"></a>more 文件内容分屏查看器</h3><p>more 指令是一个基于 VI 编辑器的文本过滤器，它以全屏幕的方式按页显示文本文件 的内容。more 指令中内置了若干快捷键，详见操作说明。</p>
<h4 id="基本语法-17"><a href="#基本语法-17" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">more 要查看的文件</span><br></pre></td></tr></table></figure>
<h4 id="操作说明"><a href="#操作说明" class="headerlink" title="操作说明"></a>操作说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>操作</th>
<th>功能说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>空白键（space）</td>
<td>代表向下翻一页</td>
</tr>
<tr>
<td>Enter</td>
<td>代表向下翻【一行】</td>
</tr>
<tr>
<td>q</td>
<td>代表立刻离开more，不再显示该文件的内容</td>
</tr>
<tr>
<td>Ctrl + F</td>
<td>向下滚动一屏</td>
</tr>
<tr>
<td>Ctrl+B</td>
<td>返回上一屏</td>
</tr>
<tr>
<td>=</td>
<td>输出当前行的行号</td>
</tr>
<tr>
<td>:f</td>
<td>输出文件名和当前行的行号</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-15"><a href="#使用-15" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">使用more查看文件</span></span><br><span class="line">more xiaofei.conf</span><br></pre></td></tr></table></figure>
<h3 id="less-分屏显示文件内容"><a href="#less-分屏显示文件内容" class="headerlink" title="less 分屏显示文件内容"></a>less 分屏显示文件内容</h3><p>less 指令用来分屏查看文件内容，它的功能与 more 指令类似，但是比 more 指令更加 强大，支持各种显示终端。less 指令在显示文件内容时，并不是一次将整个文件加载之后 才显示，而是根据显示需要加载内容，对于显示大型文件具有较高的效率。</p>
<h4 id="基本语法-18"><a href="#基本语法-18" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">less 要查看的文件</span><br></pre></td></tr></table></figure>
<h4 id="操作说明-1"><a href="#操作说明-1" class="headerlink" title="操作说明"></a>操作说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>操作</th>
<th>功能说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>空白键</td>
<td>向下翻动一页；</td>
</tr>
<tr>
<td>[pagedown]</td>
<td>向下翻动一页</td>
</tr>
<tr>
<td>[pageup]</td>
<td>向上翻动一页；</td>
</tr>
<tr>
<td>/字串</td>
<td>向下搜寻『字串』的功能；n：向下查找；N：向上查找；</td>
</tr>
<tr>
<td>?字串</td>
<td>向上搜寻『字串』的功能；n：向上查找；N：向下查找；</td>
</tr>
<tr>
<td>q</td>
<td>离开 less 这个程序；</td>
</tr>
</tbody>
</table>
</div>
<h4 id="经验技巧-2"><a href="#经验技巧-2" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>用SecureCRT时[pagedown]和[pageup]可能会出现无法识别的问题。</p>
<h4 id="使用-16"><a href="#使用-16" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">使用less查看文件</span></span><br><span class="line">less xiaofei.txt</span><br></pre></td></tr></table></figure>
<h3 id="echo输出"><a href="#echo输出" class="headerlink" title="echo输出"></a>echo输出</h3><p>echo输出内容到控制台</p>
<h4 id="基本语法-19"><a href="#基本语法-19" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">echo [选项] [输出内容]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-5"><a href="#选项说明-5" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>-e</td>
<td>支持反斜线控制的字符转换</td>
</tr>
<tr>
<td>\</td>
<td>输出\本身</td>
</tr>
<tr>
<td>\n</td>
<td>换行符</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-17"><a href="#使用-17" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">echo &quot;xiao\tfei&quot;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">输出结果：xiao\tfei</span></span><br><span class="line">echo -e &quot;xiao\tfei&quot;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">输出结果：xiao	fei</span></span><br></pre></td></tr></table></figure>
<h3 id="head-显示文件头部内容"><a href="#head-显示文件头部内容" class="headerlink" title="head 显示文件头部内容"></a>head 显示文件头部内容</h3><p>head 用于显示文件的开头部分内容，默认情况下 head 指令显示文件的前 10 行内容。</p>
<h4 id="基本语法-20"><a href="#基本语法-20" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看文件头10行内容</span></span><br><span class="line">head 文件</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看文件头5行内容，5可以是任意行数</span></span><br><span class="line">head -n 5 文件</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-6"><a href="#选项说明-6" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-n&lt;行数&gt;</td>
<td>指定显示头部内容的行数</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-18"><a href="#使用-18" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看文件的头两行</span></span><br><span class="line">head -n 2 xiaofei.conf</span><br></pre></td></tr></table></figure>
<h3 id="tail-输出文件尾部内容"><a href="#tail-输出文件尾部内容" class="headerlink" title="tail 输出文件尾部内容"></a>tail 输出文件尾部内容</h3><p>tail 用于输出文件中尾部的内容，默认情况下 tail 指令显示文件的后 10 行内容。</p>
<h4 id="基本语法-21"><a href="#基本语法-21" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看文件尾部10行内容</span></span><br><span class="line">tail 文件</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看文件尾部5行内容，5可以是任意行数</span></span><br><span class="line">tail -n 5 文件</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">实时追踪该文档的所有更新</span></span><br><span class="line">tail -f 文件</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-7"><a href="#选项说明-7" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-n&lt;行数&gt;</td>
<td>输出文件尾部n行内容</td>
</tr>
<tr>
<td>-f</td>
<td>显示文件最新追加的内容，监视文件变化</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-19"><a href="#使用-19" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看文件尾1行内容</span></span><br><span class="line">tail -n 1 xiaofei.conf</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">实时追踪该文档的所有更新</span></span><br><span class="line">tail -f xiaofei.txt</span><br></pre></td></tr></table></figure>
<h3 id="gt-输出重定向和-gt-gt-追加"><a href="#gt-输出重定向和-gt-gt-追加" class="headerlink" title="&gt; 输出重定向和 &gt;&gt; 追加"></a>&gt; 输出重定向和 &gt;&gt; 追加</h3><h4 id="基本语法-22"><a href="#基本语法-22" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">列表的内容写入文件 a.txt 中（覆盖写）</span></span><br><span class="line">ls -l &gt; 文件</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">列表的内容追加到文件 aa.txt 的末尾</span></span><br><span class="line">ls -al &gt;&gt; 文件</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">将文件 1 的内容覆盖到文件 2</span></span><br><span class="line">cat 文件1 &gt; 文件2</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">将输出的的内容写入文件中</span></span><br><span class="line">echo “内容” &gt;&gt; 文件</span><br></pre></td></tr></table></figure>
<h4 id="使用-20"><a href="#使用-20" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">将<span class="built_in">ls</span>查看信息写入到文件中</span></span><br><span class="line">ls -l &gt; xiaofei.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">将<span class="built_in">ls</span>查看信息追加到文件中</span></span><br><span class="line">ls -l &gt;&gt; xiaofei.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">采用<span class="built_in">echo</span>将xiaofei单词追加到文件中</span></span><br><span class="line">echo &quot;xiaofei&quot; &gt;&gt; xiaofei.txt</span><br></pre></td></tr></table></figure>
<h3 id="ln-软链接"><a href="#ln-软链接" class="headerlink" title="ln 软链接"></a>ln 软链接</h3><p>软链接也称为符号链接，类似于 windows 里的快捷方式，有自己的数据块，主要存放 了链接</p>
<p>其他文件的路径。</p>
<h4 id="基本语法-23"><a href="#基本语法-23" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">给原文件创建一个软链接</span></span><br><span class="line">ln -s [原文件或目录] [软链接名]</span><br></pre></td></tr></table></figure>
<h4 id="经验技巧-3"><a href="#经验技巧-3" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>删除软链接： rm -rf 软链接名，而不是 rm -rf 软链接名/ </p>
<p><strong>如果使用 rm -rf 软链接名/ 删除，会把软链接对应的真实目录下内容删掉</strong> </p>
<p>查询：通过 ll 就可以查看，列表属性第 1 位是 l，尾部会有位置指向。</p>
<h4 id="使用-21"><a href="#使用-21" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">创建软连接</span></span><br><span class="line">ln -s /xiaofei/xiaofei.txt /test</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除软连接（注意不要写最后的/）</span></span><br><span class="line">rm -rf /test</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">进入软连接实际物理路径</span></span><br><span class="line">ln -s /xiaofei/ /test</span><br><span class="line">cd -p test/</span><br></pre></td></tr></table></figure>
<h3 id="history-查看已经执行过历史命令"><a href="#history-查看已经执行过历史命令" class="headerlink" title="history 查看已经执行过历史命令"></a>history 查看已经执行过历史命令</h3><h4 id="基本语法-24"><a href="#基本语法-24" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看已经执行过历史命令</span></span><br><span class="line">history</span><br></pre></td></tr></table></figure>
<h4 id="使用-22"><a href="#使用-22" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看已经执行过的历史命令</span></span><br><span class="line">history</span><br></pre></td></tr></table></figure>
<h2 id="时间日期类"><a href="#时间日期类" class="headerlink" title="时间日期类"></a>时间日期类</h2><h3 id="date-显示当前时间"><a href="#date-显示当前时间" class="headerlink" title="date 显示当前时间"></a>date 显示当前时间</h3><h4 id="基本语法-25"><a href="#基本语法-25" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前时间</span></span><br><span class="line">date</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前年份</span></span><br><span class="line">date +%Y</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前月份</span></span><br><span class="line">date +%m</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前是哪一天</span></span><br><span class="line">date +%d</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示年月日时分秒</span></span><br><span class="line">date &quot;+%Y-%m-%d %H:%M:%S&quot;</span><br></pre></td></tr></table></figure>
<h4 id="使用-23"><a href="#使用-23" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前时间信息</span></span><br><span class="line">date</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前时间年月日</span></span><br><span class="line">date +%Y%m%d</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示当前时间年月日时分秒</span></span><br><span class="line">date &quot;+%Y-%m-%d %H:%M:%S&quot;</span><br></pre></td></tr></table></figure>
<h3 id="date显示非当前时间"><a href="#date显示非当前时间" class="headerlink" title="date显示非当前时间"></a>date显示非当前时间</h3><h4 id="基本语法-26"><a href="#基本语法-26" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示前一天的时间</span></span><br><span class="line">date -d &#x27;1 days ago&#x27;</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示明天时间</span></span><br><span class="line">date -d &#x27;-1 days ago&#x27;</span><br></pre></td></tr></table></figure>
<h3 id="date设置系统时间"><a href="#date设置系统时间" class="headerlink" title="date设置系统时间"></a>date设置系统时间</h3><h4 id="基本语法-27"><a href="#基本语法-27" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">date -s 字符串时间</span><br></pre></td></tr></table></figure>
<h4 id="使用-24"><a href="#使用-24" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">date -s &quot;2020-6-4 14:38:39&quot;</span><br></pre></td></tr></table></figure>
<h3 id="cal查看日历"><a href="#cal查看日历" class="headerlink" title="cal查看日历"></a>cal查看日历</h3><h4 id="基本语法-28"><a href="#基本语法-28" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">不加选项，显示本月日历</span></span><br><span class="line">cal [选项]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-8"><a href="#选项说明-8" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>具体某一年</td>
<td>显示这一年的日历</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-25"><a href="#使用-25" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看当前月的日历</span></span><br><span class="line">cal</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看2022年的日历</span></span><br><span class="line">cal 2022</span><br></pre></td></tr></table></figure>
<h2 id="用户管理命令"><a href="#用户管理命令" class="headerlink" title="用户管理命令"></a>用户管理命令</h2><h3 id="useradd-添加新用户"><a href="#useradd-添加新用户" class="headerlink" title="useradd 添加新用户"></a>useradd 添加新用户</h3><h4 id="基本语法-29"><a href="#基本语法-29" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">添加用户</span></span><br><span class="line">useradd 用户名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">添加新用户到某个组</span></span><br><span class="line">useradd -g 组名 用户名</span><br></pre></td></tr></table></figure>
<h4 id="使用-26"><a href="#使用-26" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">添加一个用户</span></span><br><span class="line">useradd xiaofei</span><br><span class="line">ll /home/</span><br></pre></td></tr></table></figure>
<h3 id="passwd-设置用户密码"><a href="#passwd-设置用户密码" class="headerlink" title="passwd 设置用户密码"></a>passwd 设置用户密码</h3><h4 id="基本语法-30"><a href="#基本语法-30" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置用户密码</span></span><br><span class="line">passwd 用户名</span><br></pre></td></tr></table></figure>
<h4 id="使用-27"><a href="#使用-27" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">设置xiaofei用户的密码为xiaofei</span></span><br><span class="line">passwd xiaofei</span><br></pre></td></tr></table></figure>
<h3 id="id-查看用户是否存在"><a href="#id-查看用户是否存在" class="headerlink" title="id 查看用户是否存在"></a>id 查看用户是否存在</h3><h4 id="基本语法-31"><a href="#基本语法-31" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">id 用户名</span><br></pre></td></tr></table></figure>
<h4 id="使用-28"><a href="#使用-28" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">id xiaofei</span><br></pre></td></tr></table></figure>
<h3 id="cat-etc-passwd-查看创建了哪些用户"><a href="#cat-etc-passwd-查看创建了哪些用户" class="headerlink" title="cat /etc/passwd 查看创建了哪些用户"></a>cat /etc/passwd 查看创建了哪些用户</h3><h4 id="使用-29"><a href="#使用-29" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /etc/passwd </span><br></pre></td></tr></table></figure>
<h3 id="su-切换用户"><a href="#su-切换用户" class="headerlink" title="su 切换用户"></a>su 切换用户</h3><h4 id="基本语法-32"><a href="#基本语法-32" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">切换用户，只能获得用户的执行权限，不能获得环境变量</span></span><br><span class="line">su 用户名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">切换到用户并获得该用户的环境变量及执行权限</span></span><br><span class="line">su - 用户名称</span><br></pre></td></tr></table></figure>
<h4 id="使用-30"><a href="#使用-30" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">su xiaofei</span><br><span class="line">su - xiaofei</span><br></pre></td></tr></table></figure>
<h3 id="userdel-删除用户"><a href="#userdel-删除用户" class="headerlink" title="userdel 删除用户"></a>userdel 删除用户</h3><h4 id="基本语法-33"><a href="#基本语法-33" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除用户但保存用户主目录</span></span><br><span class="line">userdel 用户名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">用户和用户主目录，都删除</span></span><br><span class="line">userdel -r 用户名</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-9"><a href="#选项说明-9" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-r</td>
<td>删除用户的同时，删除与用户相关的所有文件</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-31"><a href="#使用-31" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除用户但保存用户主目录</span></span><br><span class="line">userdel xiaofei</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除用户和主目录，都删除</span></span><br><span class="line">userdel -r xiaofei </span><br></pre></td></tr></table></figure>
<h3 id="who-查看登录用户信息"><a href="#who-查看登录用户信息" class="headerlink" title="who 查看登录用户信息"></a>who 查看登录用户信息</h3><h4 id="基本语法-34"><a href="#基本语法-34" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示自身用户名称</span></span><br><span class="line">whoami</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示登录用户的用户名以及登陆时间</span></span><br><span class="line">who am i</span><br></pre></td></tr></table></figure>
<h3 id="sudo-设置普通用户具有-root-权限"><a href="#sudo-设置普通用户具有-root-权限" class="headerlink" title="sudo 设置普通用户具有 root 权限"></a>sudo 设置普通用户具有 root 权限</h3><h4 id="使用-32"><a href="#使用-32" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">他i俺家用户xiaofei</span></span><br><span class="line">useradd xiaofei</span><br><span class="line">passwd xiaofei</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改配置文件</span></span><br><span class="line">vim /etc/sudoers</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改 /etc/sudoers 文件，找到下面一行(91 行)，在 root 下面添加一行，如下所示：</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="comment"># Allow root to run any commands anywhere</span></span> </span><br><span class="line">root ALL=(ALL) ALL 、</span><br><span class="line">xiaofei ALL=(ALL) ALL</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">或者配置成采用 sudo 命令时，不需要输入密码</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="comment"># Allow root to run any commands anywhere</span></span> </span><br><span class="line">root ALL=(ALL) ALL </span><br><span class="line">xiaofei ALL=(ALL) NOPASSWD:ALL</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改完毕，现在可以用 atguigu 帐号登录，然后用命令 sudo ，即可获得 root 权限进行 操作。</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">用普通用户在/opt 目录下创建一个文件夹</span></span><br><span class="line">su xiaofei</span><br><span class="line">sudo mkdir module</span><br><span class="line">chown xiaofei:xiaofei module/</span><br></pre></td></tr></table></figure>
<h3 id="usermod-修改用户"><a href="#usermod-修改用户" class="headerlink" title="usermod 修改用户"></a>usermod 修改用户</h3><h4 id="基本语法-35"><a href="#基本语法-35" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">usermod -g 用户组 用户名</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-10"><a href="#选项说明-10" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-g</td>
<td>修改用户的初始登录组，给定的组必须存在，默认组id是1</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-33"><a href="#使用-33" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">usermod -g root zhubajie</span><br></pre></td></tr></table></figure>
<h2 id="用户组管理命令"><a href="#用户组管理命令" class="headerlink" title="用户组管理命令"></a>用户组管理命令</h2><h3 id="groupadd-新增组"><a href="#groupadd-新增组" class="headerlink" title="groupadd 新增组"></a>groupadd 新增组</h3><h4 id="基本语法-36"><a href="#基本语法-36" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">新增组</span></span><br><span class="line">groupadd 组名</span><br></pre></td></tr></table></figure>
<h4 id="使用-34"><a href="#使用-34" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">增加一个xiaofei组</span></span><br><span class="line">groupadd xiaofei</span><br></pre></td></tr></table></figure>
<h3 id="groupdel-删除组"><a href="#groupdel-删除组" class="headerlink" title="groupdel 删除组"></a>groupdel 删除组</h3><h4 id="基本语法-37"><a href="#基本语法-37" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">groupdel 组名</span><br></pre></td></tr></table></figure>
<h4 id="使用-35"><a href="#使用-35" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除xiaofei组</span></span><br><span class="line">groupdel xiaofei</span><br></pre></td></tr></table></figure>
<h3 id="groupmod-修改组"><a href="#groupmod-修改组" class="headerlink" title="groupmod 修改组"></a>groupmod 修改组</h3><h4 id="基本语法-38"><a href="#基本语法-38" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">groupmod -n 新组名 老组名</span><br></pre></td></tr></table></figure>
<h4 id="选项"><a href="#选项" class="headerlink" title="选项"></a>选项</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>-n &lt;新组名&gt;</td>
<td>指定工作组的新组名</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-36"><a href="#使用-36" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改xiaofei组名为xiaofei1</span></span><br><span class="line">groupmod -n xiaofei1 xiaofei</span><br></pre></td></tr></table></figure>
<h3 id="cat-etc-group-查看创建了哪些组"><a href="#cat-etc-group-查看创建了哪些组" class="headerlink" title="cat  /etc/group 查看创建了哪些组"></a>cat  /etc/group 查看创建了哪些组</h3><h4 id="使用-37"><a href="#使用-37" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /etc/group</span><br></pre></td></tr></table></figure>
<h2 id="文件权限类"><a href="#文件权限类" class="headerlink" title="文件权限类"></a>文件权限类</h2><h3 id="文件属性"><a href="#文件属性" class="headerlink" title="文件属性"></a>文件属性</h3><p>Linux系统是一种典型的多用户系统，不同的用户处于不同的地位，拥有不同的权限。 为了保</p>
<p>护系统的安全性，Linux系统对不同的用户访问同一文件（包括目录文件）的权限做 了不同的</p>
<p>规定。在Linux中我们可以使用ll或者ls -l命令来显示一个文件的属性以及文件所属 的用户和组。</p>
<h4 id="从左到右的-10-个字符表示"><a href="#从左到右的-10-个字符表示" class="headerlink" title="从左到右的 10 个字符表示"></a>从左到右的 10 个字符表示</h4><p><img src= "" data-lazy-src="https://www.naste.top:9000/webp/image-20220604203231400.webp" alt="image-20220604203231400"></p>
<p>如果没有权限，就会出现减号[ - ]而已。从左至右用0-9这些数字来表示</p>
<ol>
<li>0 首位表示类型<ul>
<li>在Linux中第一个字符代表这个文件是目录、文件或链接文件等等 </li>
<li>-代表文件 </li>
<li>d 代表目录 </li>
<li>l 链接文档(link file)；</li>
</ul>
</li>
<li>第1-3位确定属主（该文件的所有者）拥有该文件的权限。—-User</li>
<li>第4-6位确定属组（所有者的同组用户）拥有该文件的权限，—-Group</li>
<li>第7-9位确定其他用户拥有该文件的权限 —-Other</li>
</ol>
<h4 id="rwx-作用文件和目录的不同解释"><a href="#rwx-作用文件和目录的不同解释" class="headerlink" title="rwx 作用文件和目录的不同解释"></a>rwx 作用文件和目录的不同解释</h4><ol>
<li><p>作用到文件：</p>
<ul>
<li><p>[ r ]代表可读(read): 可以读取，查看 </p>
</li>
<li><p>[ w ]代表可写(write): 可以修改，但是不代表可以删除该文件，删除一个文件的前 </p>
<p>提条件是对该文件所在的目录有写权限，才能删除该文件</p>
</li>
<li><p>[ x ]代表可执行(execute):可以被系统执行</p>
</li>
</ul>
</li>
<li><p>作用到目录：</p>
<ul>
<li>[ r ]代表可读(read): 可以读取，ls查看目录内容 </li>
<li>[ w ]代表可写(write): 可以修改，目录内创建+删除+重命名目录 </li>
<li>[ x ]代表可执行(execute):可以进入该目录</li>
</ul>
</li>
</ol>
<h4 id="使用-38"><a href="#使用-38" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[root@xiaofei xiaofei]# ll</span><br><span class="line">总用量 0</span><br><span class="line">drwxr-xr-x. 2 root root 6 6月   4 20:38 test</span><br><span class="line">-rw-r--r--. 1 root root 0 6月   4 20:38 xiaofei.txt</span><br></pre></td></tr></table></figure>
<h3 id="chmod-改变权限"><a href="#chmod-改变权限" class="headerlink" title="chmod 改变权限"></a>chmod 改变权限</h3><ol>
<li><p>第一种方式变更权限</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod [&#123;ugoa&#125;&#123;+-=&#125;&#123;rwx&#125;] 文件或目录</span><br></pre></td></tr></table></figure>
</li>
<li><p>第二种方式变更权限</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod [mode=421 ] [文件或目录]</span><br></pre></td></tr></table></figure>
<h4 id="经验技巧-4"><a href="#经验技巧-4" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>u:所有者 g:所有组 o:其他人 a:所有人(u、g、o 的总和)</p>
<p>r=4 w=2 x=1 </p>
<p>rwx=4+2+1=7</p>
</li>
</ol>
<h4 id="使用-39"><a href="#使用-39" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改文件使其所属主用户具有执行权限</span></span><br><span class="line">chmod u+x xiaofei.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改文件使其所属组用户具有执行权限</span></span><br><span class="line">chmod g+x xiaofei.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改文件所属主用户执行权限,并使其他用户具有执行权限</span></span><br><span class="line">chmod u-x,o+x xiaofei.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">采用数字的方式，设置文件所有者、所属组、其他用户都具有可读可写可执行权 限。(常用)</span></span><br><span class="line">chmod 777 xiaofei.txt</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改整个文件夹里面的所有文件的所有者、所属组、其他用户都具有可读可写可 执行权限。</span></span><br><span class="line">chmod -R 777 xiaofei/</span><br></pre></td></tr></table></figure>
<h3 id="chown-改变所有者"><a href="#chown-改变所有者" class="headerlink" title="chown 改变所有者"></a>chown 改变所有者</h3><h4 id="基本语法-39"><a href="#基本语法-39" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">改变文件或者目录的所有</span></span><br><span class="line">chown [选项] [最终用户] [文件或目录]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-11"><a href="#选项说明-11" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-R</td>
<td>递归操作</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-40"><a href="#使用-40" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改文件所有者</span></span><br><span class="line">chown xiaofei xiaofei.txt</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">递归改变文件所有者和所有组</span></span><br><span class="line">chown -R atguigu:atguigu xiyou/</span><br></pre></td></tr></table></figure>
<h3 id="chgrp-改变所属组"><a href="#chgrp-改变所属组" class="headerlink" title="chgrp 改变所属组"></a>chgrp 改变所属组</h3><h4 id="基本语法-40"><a href="#基本语法-40" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">改变文件或者目录的所属组</span></span><br><span class="line">chgrp [最终用户组] [文件或目录]</span><br></pre></td></tr></table></figure>
<h4 id="使用-41"><a href="#使用-41" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">修改文件的所属组</span></span><br><span class="line">chgrp root xiaofei.txt </span><br><span class="line">ls -al </span><br><span class="line">-rwxrwxrwx. 1 xiaofei root 551 5 月 23 13:02 xiaofei.txt</span><br></pre></td></tr></table></figure>
<h2 id="搜索查找类"><a href="#搜索查找类" class="headerlink" title="搜索查找类"></a><strong>搜索查找类</strong></h2><h3 id="find查找文件或者目录"><a href="#find查找文件或者目录" class="headerlink" title="find查找文件或者目录"></a>find查找文件或者目录</h3><p>find 指令将从指定目录向下递归地遍历其各个子目录，将满足条件的文件显示在终端。</p>
<h4 id="基本语法-41"><a href="#基本语法-41" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find [搜索范围] [选项]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-12"><a href="#选项说明-12" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-name</td>
<td>按照指定的文件名查找模式查找文件</td>
</tr>
<tr>
<td>-user&lt;用户名&gt;</td>
<td>查找属于指定用户名所有文件</td>
</tr>
<tr>
<td>-size&lt;文件大小&gt;</td>
<td>按照指定的文件大小查找文件,单位为: b —— 块（512 字节） c —— 字节 w —— 字（2 字节） k —— 千字节 M —— 兆字节 G —— 吉字节</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-42"><a href="#使用-42" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">根据名称查找/目录下的所有后缀为.txt文件</span></span><br><span class="line">find /xiaofei/ -name &quot;*.txt&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查找/opt目录下，用户名称为-user的文件</span></span><br><span class="line">find /opt/ -user xiaofei</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">在/home目录下查找大于200m的文件（+n 大于 -n小于 n等于）</span></span><br><span class="line">find /home -size +204800</span><br></pre></td></tr></table></figure>
<h3 id="locate-快速定位文件路径"><a href="#locate-快速定位文件路径" class="headerlink" title="locate 快速定位文件路径"></a>locate 快速定位文件路径</h3><p>locate 指令利用事先建立的系统中所有文件名称及路径的 locate 数据库实现快速定位给 定的文</p>
<p>件。Locate 指令无需遍历整个文件系统，查询速度较快。为了保证查询结果的准确 度，管理员</p>
<p>必须定期更新 locate 时刻。</p>
<h4 id="基本语法-42"><a href="#基本语法-42" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">locate 搜索文件</span><br></pre></td></tr></table></figure>
<h4 id="经验技巧-5"><a href="#经验技巧-5" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>由于 locate 指令基于数据库进行查询，所以第一次运行前，必须使用 updatedb 指令创建 </p>
<p>locate 数据库。</p>
<h4 id="使用-43"><a href="#使用-43" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">第一次运行前，必须使用 updatedb 指令创建 locate 数据库。</span></span><br><span class="line">updatedb</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查询tmp文件夹</span></span><br><span class="line">locate tmp</span><br></pre></td></tr></table></figure>
<h3 id="grep-过滤查找及“-”管道符"><a href="#grep-过滤查找及“-”管道符" class="headerlink" title="grep 过滤查找及“|”管道符"></a>grep 过滤查找及“|”管道符</h3><p>管道符，“|”，表示将前一个命令的处理结果输出传递给后面的命令处理</p>
<h4 id="基本语法-43"><a href="#基本语法-43" class="headerlink" title="基本语法"></a>基本语法</h4><p>grep 选项 查找内容 源文件</p>
<h4 id="选项说明-13"><a href="#选项说明-13" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-n</td>
<td>显示匹配行及行号</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-44"><a href="#使用-44" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查找某文件在第几行</span></span><br><span class="line">ls | grep -n test</span><br></pre></td></tr></table></figure>
<h2 id="压缩和解压类"><a href="#压缩和解压类" class="headerlink" title="压缩和解压类"></a>压缩和解压类</h2><h3 id="gzip-gunzip-压缩"><a href="#gzip-gunzip-压缩" class="headerlink" title="gzip/gunzip 压缩"></a>gzip/gunzip 压缩</h3><h4 id="基本语法-44"><a href="#基本语法-44" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">压缩文件，只能将文件压缩为*.gz 文件</span></span><br><span class="line">gzip 文件</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">解压缩文件命令</span></span><br><span class="line">gunzip 文件.gz</span><br></pre></td></tr></table></figure>
<h4 id="经验技巧-6"><a href="#经验技巧-6" class="headerlink" title="经验技巧"></a>经验技巧</h4><ul>
<li>只能压缩文件不能压缩目录</li>
<li>不保留原来的文件</li>
<li>同时多个文件会产生多个压缩包</li>
</ul>
<h4 id="使用-45"><a href="#使用-45" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">gzip压缩</span></span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">test.java</span><br><span class="line">[root@xiaofei test]# gzip test.java</span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">test.java.gz</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">gunzip解压文件</span></span><br><span class="line">[root@xiaofei test]# gunzip test.java.gz </span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">test.java</span><br></pre></td></tr></table></figure>
<h3 id="zip-unzip-压缩"><a href="#zip-unzip-压缩" class="headerlink" title="zip/unzip 压缩"></a>zip/unzip 压缩</h3><h4 id="基本语法-45"><a href="#基本语法-45" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">压缩文件和目录的命令</span></span><br><span class="line">zip [选项] XXX.zip 将要压缩的内容</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">解压缩文件</span></span><br><span class="line">unzip [选项] XXX.zip</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-14"><a href="#选项说明-14" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>zip选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-r</td>
<td>压缩目录</td>
</tr>
</tbody>
</table>
</div>
<div class="table-container">
<table>
<thead>
<tr>
<th>unzip选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-d&lt;目录&gt;</td>
<td>指定解压后文件的存放目录</td>
</tr>
</tbody>
</table>
</div>
<h4 id="经验技巧-7"><a href="#经验技巧-7" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>zip 压缩命令在windows/linux都通用，可以压缩目录且保留源文件。</p>
<h4 id="使用-46"><a href="#使用-46" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">压缩 xiaofei.txt和xiaofei1.txt，压缩后的名称为xiaofei.zip</span></span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">xiaofei1.txt  xiaofei.txt</span><br><span class="line">[root@xiaofei test]# zip xiaofei.zip xiaofei.txt xiaofei1.txt </span><br><span class="line">  adding: xiaofei.txt (stored 0%)</span><br><span class="line">  adding: xiaofei1.txt (stored 0%)</span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">xiaofei1.txt  xiaofei.txt  xiaofei.zip</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">解压xiaofei.zip</span></span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">xiaofei.zip</span><br><span class="line">[root@xiaofei test]# unzip xiaofei.zip </span><br><span class="line">Archive:  xiaofei.zip</span><br><span class="line"> extracting: xiaofei.txt             </span><br><span class="line"> extracting: xiaofei1.txt            </span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">xiaofei1.txt  xiaofei.txt  xiaofei.zip</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">解压xiaofei.zip到指定目录-d</span></span><br><span class="line">[root@xiaofei test]# ls /test</span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">xiaofei1.txt  xiaofei.txt  xiaofei.zip</span><br><span class="line">[root@xiaofei test]# unzip xiaofei.zip -d /test</span><br><span class="line">Archive:  xiaofei.zip</span><br><span class="line"> extracting: /test/xiaofei.txt       </span><br><span class="line"> extracting: /test/xiaofei1.txt      </span><br><span class="line">[root@xiaofei test]# ls /test</span><br><span class="line">xiaofei1.txt  xiaofei.txt</span><br></pre></td></tr></table></figure>
<h3 id="tar-打包"><a href="#tar-打包" class="headerlink" title="tar 打包"></a>tar 打包</h3><h4 id="基本语法-46"><a href="#基本语法-46" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">打包目录，压缩后的 文件格式.tar.gz</span></span><br><span class="line">tar [选项] XXX.tar.gz 将要打包进去的内容</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-15"><a href="#选项说明-15" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-c</td>
<td>产生.tar 打包文件</td>
</tr>
<tr>
<td>-v</td>
<td>显示详细信息</td>
</tr>
<tr>
<td>-f</td>
<td>指定压缩后的文件名</td>
</tr>
<tr>
<td>-z</td>
<td>打包同时压缩</td>
</tr>
<tr>
<td>-x</td>
<td>解包.tar 文件</td>
</tr>
<tr>
<td>-C</td>
<td>解压到指定目录</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-47"><a href="#使用-47" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">压缩多个文件</span></span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">xiaofei1.txt  xiaofei.txt</span><br><span class="line">[root@xiaofei test]# tar -zcvf xiaofei.tar.gz xiaofei.txt xiaofei1.txt </span><br><span class="line">xiaofei.txt</span><br><span class="line">xiaofei1.txt</span><br><span class="line">[root@xiaofei test]# ls</span><br><span class="line">xiaofei1.txt  xiaofei.tar.gz  xiaofei.txt</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">压缩目录</span></span><br><span class="line">[root@xiaofei xiaofei]# tar -zcvf xiaofei.tar.gz test/test/</span><br><span class="line">test/xiaofei.txt</span><br><span class="line">[root@xiaofei xiaofei]# ls</span><br><span class="line">test  xiaofei.tar.gz</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">解压到当前目录</span></span><br><span class="line">tar -zxvf xiaofei.tar.gz</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">解压到指定目录</span></span><br><span class="line">tar -zxvf xiaofei.tar.gz -C /xiaofei</span><br><span class="line">ll /xiaofei/</span><br></pre></td></tr></table></figure>
<h2 id="磁盘查看和分区类"><a href="#磁盘查看和分区类" class="headerlink" title="磁盘查看和分区类"></a>磁盘查看和分区类</h2><h3 id="du-查看文件和目录占用的磁盘空间"><a href="#du-查看文件和目录占用的磁盘空间" class="headerlink" title="du 查看文件和目录占用的磁盘空间"></a>du 查看文件和目录占用的磁盘空间</h3><p>du：disk usage 磁盘占用情况</p>
<h4 id="基本语法-47"><a href="#基本语法-47" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示目录下每个子目录的磁盘使用情况</span></span><br><span class="line">du 目录/文件</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-16"><a href="#选项说明-16" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-h</td>
<td>以人们较易阅读的 GBytes, MBytes, KBytes 等格式自行显示；</td>
</tr>
<tr>
<td>-a</td>
<td>不仅查看子目录大小，还要包括文件</td>
</tr>
<tr>
<td>-c</td>
<td>显示所有的文件和子目录大小后，显示总和</td>
</tr>
<tr>
<td>-s</td>
<td>只显示总和</td>
</tr>
<tr>
<td>—max-depth=n</td>
<td>指定统计子目录的深度为第 n 层</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-48"><a href="#使用-48" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看当前用户主目录占用的磁盘空间大小</span></span><br><span class="line">du -sh</span><br></pre></td></tr></table></figure>
<h3 id="df-查看磁盘空间使用情况"><a href="#df-查看磁盘空间使用情况" class="headerlink" title="df 查看磁盘空间使用情况"></a>df 查看磁盘空间使用情况</h3><p>df：disk free 空余磁盘</p>
<h4 id="基本语法-48"><a href="#基本语法-48" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">列出文件系统的整体磁盘使用量，检查文件系统的磁盘空间占 用情况</span></span><br><span class="line">df 选项 </span><br></pre></td></tr></table></figure>
<h4 id="选项说明-17"><a href="#选项说明-17" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-h</td>
<td>以人们较易阅读的 GBytes, MBytes, KBytes 等格式自行显示；</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-49"><a href="#使用-49" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看磁盘使用情况</span></span><br><span class="line">df -h</span><br></pre></td></tr></table></figure>
<h3 id="lsblk-查看设备挂载情况"><a href="#lsblk-查看设备挂载情况" class="headerlink" title="lsblk 查看设备挂载情况"></a>lsblk 查看设备挂载情况</h3><h4 id="基本语法-49"><a href="#基本语法-49" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看设备挂载情况</span></span><br><span class="line">lsblk 选项</span><br></pre></td></tr></table></figure>
<h4 id="查看选项"><a href="#查看选项" class="headerlink" title="查看选项"></a>查看选项</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-f</td>
<td>查看详细的设备挂载情况，显示文件系统信息</td>
</tr>
</tbody>
</table>
</div>
<h3 id="mount-umount-挂载-卸载"><a href="#mount-umount-挂载-卸载" class="headerlink" title="mount/umount 挂载/卸载"></a>mount/umount 挂载/卸载</h3><ol>
<li>对于Linux用户来讲，不论有几个分区，分别分给哪一个目录使用，它总归就是一个根 目录、一个独立且唯一的文件结构。</li>
<li>Linux中每个分区都是用来组成整个文件系统的一部分，它在用一种叫做“挂载”的处理 方法，它整个文件系统中包含了一整套的文件和目录，并将一个分区和一个目录联系起来， 要载入的那个分区将使它的存储空间在这个目录下获得</li>
</ol>
<blockquote>
<p><strong>注意：由于该功能不常使用，需要了解去百度</strong></p>
</blockquote>
<h3 id="fdisk-分区"><a href="#fdisk-分区" class="headerlink" title="fdisk 分区"></a>fdisk 分区</h3><h4 id="基本语法-50"><a href="#基本语法-50" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看磁盘分区详情</span></span><br><span class="line">fdisk -l</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">对新增硬盘进行分区操作</span></span><br><span class="line">fdisk 硬盘设备名</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-18"><a href="#选项说明-18" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-l</td>
<td>显示所有硬盘的分区列表</td>
</tr>
</tbody>
</table>
</div>
<h4 id="经验技巧-8"><a href="#经验技巧-8" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>该命令必须在 root 用户下才能使用</p>
<h4 id="功能说明"><a href="#功能说明" class="headerlink" title="功能说明"></a>功能说明</h4><ol>
<li><p>Linux分区</p>
<p>Device：分区序列 </p>
<p>Boot：引导 </p>
<p>Start：从X磁柱开始 </p>
<p>End：到Y磁柱结束 </p>
<p>Blocks：容量 </p>
<p>Id：分区类型ID </p>
<p>System：分区类型</p>
</li>
<li><p>分区操作按键说明</p>
<p>m：显示命令列表 </p>
<p>p：显示当前磁盘分区 </p>
<p>n：新增分区 </p>
<p>w：写入分区信息并退出 </p>
<p>q：不保存分区信息直接退出</p>
</li>
</ol>
<h4 id="使用-50"><a href="#使用-50" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看系统分区情况</span></span><br><span class="line">fdisk -l</span><br></pre></td></tr></table></figure>
<h2 id="进程管理类"><a href="#进程管理类" class="headerlink" title="进程管理类"></a>进程管理类</h2><h3 id="ps-查看当前系统进程状态"><a href="#ps-查看当前系统进程状态" class="headerlink" title="ps 查看当前系统进程状态"></a>ps 查看当前系统进程状态</h3><p>ps：process status 进程状态</p>
<h4 id="基本语法-51"><a href="#基本语法-51" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看系统中所有进程</span></span><br><span class="line">ps aux | grep xxx</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">可以查看子父进程之间的关系</span></span><br><span class="line">ps -ef | grep xxx</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-19"><a href="#选项说明-19" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>a</td>
<td>列出带有终端的所有用户的进程</td>
</tr>
<tr>
<td>x</td>
<td>列出当前用户的所有进程，包括没有终端的进程</td>
</tr>
<tr>
<td>u</td>
<td>面向用户友好的显示风格</td>
</tr>
<tr>
<td>-e</td>
<td>列出所有进程</td>
</tr>
<tr>
<td>-u</td>
<td>列出某个用户关联的所有进程</td>
</tr>
<tr>
<td>-f</td>
<td>显示完整格式的进程列表</td>
</tr>
</tbody>
</table>
</div>
<h4 id="功能说明-1"><a href="#功能说明-1" class="headerlink" title="功能说明"></a>功能说明</h4><ol>
<li><p>ps aux 显示信息说明</p>
<p>USER：该进程是由哪个用户产生的 </p>
<p>PID：进程的 ID 号 </p>
<p>%CPU：该进程占用 CPU 资源的百分比，占用越高，进程越耗费资源； </p>
<p>%MEM：该进程占用物理内存的百分比，占用越高，进程越耗费资源； </p>
<p>VSZ：该进程占用虚拟内存的大小，单位 KB； </p>
<p>RSS：该进程占用实际物理内存的大小，单位 KB； </p>
<p>TTY：该进程是在哪个终端中运行的。对于 CentOS 来说，tty1 是图形化终端， </p>
<p>tty2-tty6 是本地的字符界面终端。pts/0-255 代表虚拟终端。 </p>
<p>STAT：进程状态。常见的状态有：R：运行状态、S：睡眠状态、T：暂停状态、 </p>
<p>​                Z：僵尸状态、s：包含子进程、l：多线程、+：前台显示 </p>
<p>START：该进程的启动时间</p>
<p>TIME：该进程占用 CPU 的运算时间，注意不是系统时间 </p>
<p>COMMAND：产生此进程的命令名 </p>
</li>
<li><p>ps -ef 显示信息说明</p>
<p>UID：用户 ID </p>
<p>PID：进程 ID </p>
<p>PPID：父进程 ID </p>
<p>C：CPU 用于计算执行优先级的因子。数值越大，表明进程是 CPU 密集型运算， </p>
<p>执行优先级会降低；数值越小，表明进程是 I/O 密集型运算，执行优先级会提高 </p>
<p>STIME：进程启动的时间 </p>
<p>TTY：完整的终端名称 </p>
<p>TIME：CPU 时间 </p>
<p>CMD：启动进程所用的命令和参数</p>
</li>
</ol>
<h4 id="经验技巧-9"><a href="#经验技巧-9" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>如果想查看进程的 CPU 占用率和内存占用率，可以使用 aux; 如果想查看进程的父进程 ID 可以使用 ef；</p>
<h4 id="使用-51"><a href="#使用-51" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">ps aux</span><br><span class="line"></span><br><span class="line">ps -ef</span><br></pre></td></tr></table></figure>
<h3 id="kill-终止进程"><a href="#kill-终止进程" class="headerlink" title="kill 终止进程"></a>kill 终止进程</h3><h4 id="基本语法-52"><a href="#基本语法-52" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">通过进程号杀死进程</span></span><br><span class="line">kill [选项] 进程号</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">通过进程名称杀死进程，也支持通配符，这 在系统因负载过大而变得很慢时很有用</span></span><br><span class="line">killall 进程名称</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-20"><a href="#选项说明-20" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-9</td>
<td>表示强迫进程立即停止</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-52"><a href="#使用-52" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">杀死浏览器进程</span></span><br><span class="line">kill -9 5102</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">通过进程名称杀死进程</span></span><br><span class="line">killall firefox</span><br></pre></td></tr></table></figure>
<h3 id="pstree-查看进程树"><a href="#pstree-查看进程树" class="headerlink" title="pstree 查看进程树"></a>pstree 查看进程树</h3><h4 id="基本语法-53"><a href="#基本语法-53" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pstree [选项]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-21"><a href="#选项说明-21" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-p</td>
<td>显示进程的PID</td>
</tr>
<tr>
<td>-u</td>
<td>显示进程的所属用户</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-53"><a href="#使用-53" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示进程pid</span></span><br><span class="line">pstree -p</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">显示进程所属用户</span></span><br><span class="line">pstree -u</span><br></pre></td></tr></table></figure>
<h3 id="top-实时监控系统进程状态"><a href="#top-实时监控系统进程状态" class="headerlink" title="top 实时监控系统进程状态"></a>top 实时监控系统进程状态</h3><h4 id="基本命令"><a href="#基本命令" class="headerlink" title="基本命令"></a>基本命令</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">top[选项]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-22"><a href="#选项说明-22" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-d 秒数</td>
<td>指定 top 命令每隔几秒更新。默认是 3 秒在 top 命令的交互模式当 中可以执行的命令：</td>
</tr>
<tr>
<td>-i</td>
<td>使 top 不显示任何闲置或者僵死进程</td>
</tr>
<tr>
<td>-p</td>
<td>通过指定监控进程 ID 来仅仅监控某个进程的状态</td>
</tr>
</tbody>
</table>
</div>
<h4 id="操作说明-2"><a href="#操作说明-2" class="headerlink" title="操作说明"></a>操作说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>操作</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>P</td>
<td>以CPU使用率排序，默认就是此项</td>
</tr>
<tr>
<td>M</td>
<td>以内存的使用率排序</td>
</tr>
<tr>
<td>N</td>
<td>以PID排序</td>
</tr>
<tr>
<td>q</td>
<td>退出top</td>
</tr>
</tbody>
</table>
</div>
<h4 id="查询结果字段解释"><a href="#查询结果字段解释" class="headerlink" title="查询结果字段解释"></a>查询结果字段解释</h4><p>第一行信息为任务队列信息</p>
<blockquote>
<p><strong>其他查询字段解释可以自行百度</strong></p>
</blockquote>
<h4 id="使用-54"><a href="#使用-54" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">top -d 1</span><br><span class="line">top -i</span><br><span class="line">top -p 2575</span><br></pre></td></tr></table></figure>
<p>执行上述命令后，可以按 P、M、N 对查询出的进程结果进行排序</p>
<h3 id="netstat-显示网络状态和端口占用信息"><a href="#netstat-显示网络状态和端口占用信息" class="headerlink" title="netstat 显示网络状态和端口占用信息"></a>netstat 显示网络状态和端口占用信息</h3><h4 id="基本语法-54"><a href="#基本语法-54" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看该进程网络信息</span></span><br><span class="line">netstat -anp | grep 进程号</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看网络端口号占用情况</span></span><br><span class="line">netstat –nlp | grep 端口号</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-23"><a href="#选项说明-23" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-a</td>
<td>显示所有正在监听（listen）和未监听的套接字（socket）</td>
</tr>
<tr>
<td>-n</td>
<td>拒绝显示别名，能显示数字的全部转化成数字</td>
</tr>
<tr>
<td>-l</td>
<td>仅列出在监听的服务状态</td>
</tr>
<tr>
<td>-p</td>
<td>表示显示哪个进程在调用</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-55"><a href="#使用-55" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">通过进程号查看sshd进程的网络信息</span></span><br><span class="line">netstat -anp | grep sshd</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看某端口号是否被占用</span></span><br><span class="line">netstat -nltp | grep 22</span><br></pre></td></tr></table></figure>
<h2 id="crontab-系统定时任务"><a href="#crontab-系统定时任务" class="headerlink" title="crontab 系统定时任务"></a>crontab 系统定时任务</h2><h3 id="crontab-服务管理"><a href="#crontab-服务管理" class="headerlink" title="crontab 服务管理"></a>crontab 服务管理</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">重新启动 crond 服务</span></span><br><span class="line">systemctl restart crond</span><br></pre></td></tr></table></figure>
<h3 id="crontab-定时任务设置"><a href="#crontab-定时任务设置" class="headerlink" title="crontab 定时任务设置"></a>crontab 定时任务设置</h3><h4 id="基本语法-55"><a href="#基本语法-55" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">crontab [选项]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-24"><a href="#选项说明-24" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-e</td>
<td>编辑 crontab 定时任务</td>
</tr>
<tr>
<td>-l</td>
<td>查询 crontab 任务</td>
</tr>
<tr>
<td>-r</td>
<td>删除当前用户所有的 crontab 任务</td>
</tr>
</tbody>
</table>
</div>
<h4 id="参数说明-2"><a href="#参数说明-2" class="headerlink" title="参数说明"></a>参数说明</h4><blockquote>
<p><strong>具体参数说明请自行百度</strong></p>
</blockquote>
<h4 id="使用-56"><a href="#使用-56" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">打开crontab文件</span></span><br><span class="line">crontab -e</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">每隔 1 分钟，向/root/xiaofei.txt 文件中添加一个 11 的数字</span></span><br><span class="line">*/1 * * * * /bin/echo ”11” &gt;&gt; /root/xiaofei.txt</span><br></pre></td></tr></table></figure>
<h1 id="软件包管理"><a href="#软件包管理" class="headerlink" title="软件包管理"></a>软件包管理</h1><h2 id="RPM"><a href="#RPM" class="headerlink" title="RPM"></a>RPM</h2><h3 id="RPM概述"><a href="#RPM概述" class="headerlink" title="RPM概述"></a>RPM概述</h3><p>RPM（RedHat Package Manager），RedHat软件包管理工具，类似windows里面的setup.exe 是Linux这系列操作系统里面的打包安装工具，它虽然是RedHat的标志，但理念是通用的。</p>
<p>RPM包的名称格式</p>
<p>Apache-1.3.23-11.i386.rpm</p>
<ul>
<li>- “apache” 软件名称 </li>
<li>- “1.3.23-11”软件的版本号，主版本和此版本 </li>
<li>- “i386”是软件所运行的硬件平台，Intel 32位处理器的统称 </li>
<li>- “rpm”文件扩展名，代表RPM包</li>
</ul>
<h3 id="RPM-查询命令（rpm-qa）"><a href="#RPM-查询命令（rpm-qa）" class="headerlink" title="RPM 查询命令（rpm -qa）"></a>RPM 查询命令（rpm -qa）</h3><h4 id="基本语法-56"><a href="#基本语法-56" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查询所安装的所有 rpm 软件包</span></span><br><span class="line">rpm -qa</span><br></pre></td></tr></table></figure>
<h4 id="经验技巧-10"><a href="#经验技巧-10" class="headerlink" title="经验技巧"></a>经验技巧</h4><p>由于软件包比较多，一般都会采取过滤。rpm -qa | grep rpm软件包</p>
<h4 id="使用-57"><a href="#使用-57" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">chakan firefox软件安装情况</span></span><br><span class="line">rpm -qa |grep firefox</span><br></pre></td></tr></table></figure>
<h3 id="RPM-卸载命令（rpm-e）"><a href="#RPM-卸载命令（rpm-e）" class="headerlink" title="RPM 卸载命令（rpm -e）"></a>RPM 卸载命令（rpm -e）</h3><h4 id="基本语法-57"><a href="#基本语法-57" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">rpm -e RPM软件包</span><br><span class="line"></span><br><span class="line">rpm -e --nodeps 软件包</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-25"><a href="#选项说明-25" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-e</td>
<td>卸载软件包</td>
</tr>
<tr>
<td>—nodeps</td>
<td>卸载软件时，不检查依赖。这样的话，那些使用该软件包的软件在此之后可能就不能正常工作了。</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-58"><a href="#使用-58" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">卸载Firefox软件</span></span><br><span class="line">rpm -e firefox</span><br></pre></td></tr></table></figure>
<h3 id="RPM-安装命令（rpm-ivh）"><a href="#RPM-安装命令（rpm-ivh）" class="headerlink" title="RPM 安装命令（rpm -ivh）"></a>RPM 安装命令（rpm -ivh）</h3><h4 id="基本语法-58"><a href="#基本语法-58" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rpm -ivh RPM 包全名</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-26"><a href="#选项说明-26" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-i</td>
<td>install，安装</td>
</tr>
<tr>
<td>-v</td>
<td>—verbose，显示详细信息</td>
</tr>
<tr>
<td>-h</td>
<td>—hash，进度条</td>
</tr>
<tr>
<td>—nodeps</td>
<td>安装前不检查依赖</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-59"><a href="#使用-59" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">安装Firefox软件</span></span><br><span class="line">[root@hadoop101 Packages]# pwd /run/media/root/CentOS 7 x86_64/Packages [root@hadoop101 Packages]# rpm -ivh firefox-45.0.1-1.el6.centos.x86_64.rpm warning: firefox-45.0.1-1.el6.centos.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%] 1:firefox ########################################### [100%]</span><br></pre></td></tr></table></figure>
<h2 id="YUM仓库配置"><a href="#YUM仓库配置" class="headerlink" title="YUM仓库配置"></a><a target="_blank" rel="noopener" href="https://www.runoob.com/linux/linux-yum.html">YUM仓库配置</a></h2><h3 id="YUN概述"><a href="#YUN概述" class="headerlink" title="YUN概述"></a>YUN概述</h3><p>YUM（全称为 Yellow dog Updater, Modified）是一个在 Fedora 和 RedHat 以及 CentOS 中的 Shell 前端软件包管理器。基于 RPM 包管理，能够从指定的服务器自动下载 RPM 包 并且安装，可以自动处理依赖性关系，并且一次安装所有依赖的软件包，无须繁琐地一次 次下载、安装</p>
<h3 id="YUM的常用命令"><a href="#YUM的常用命令" class="headerlink" title="YUM的常用命令"></a>YUM的常用命令</h3><h4 id="基本语法-59"><a href="#基本语法-59" class="headerlink" title="基本语法"></a>基本语法</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yun [选项][参数]</span><br></pre></td></tr></table></figure>
<h4 id="选项说明-27"><a href="#选项说明-27" class="headerlink" title="选项说明"></a>选项说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>选项</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>-y</td>
<td>对所有提问都回答“yes”</td>
</tr>
</tbody>
</table>
</div>
<h4 id="参数说明-3"><a href="#参数说明-3" class="headerlink" title="参数说明"></a>参数说明</h4><div class="table-container">
<table>
<thead>
<tr>
<th>参数</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>install</td>
<td>安装 rpm 软件包</td>
</tr>
<tr>
<td>update</td>
<td>更新 rpm 软件包</td>
</tr>
<tr>
<td>check-update</td>
<td>检查是否有可用的更新 rpm 软件包</td>
</tr>
<tr>
<td>remove</td>
<td>删除指定的 rpm 软件包</td>
</tr>
<tr>
<td>list</td>
<td>显示软件包信息</td>
</tr>
<tr>
<td>clean</td>
<td>清理 yum 过期的缓存</td>
</tr>
<tr>
<td>deplist</td>
<td>显示 yum 软件包的所有依赖关系</td>
</tr>
</tbody>
</table>
</div>
<h4 id="使用-60"><a href="#使用-60" class="headerlink" title="使用"></a>使用</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">使用yum方式安装firefox</span>	</span><br><span class="line">yum -y install firefox</span><br></pre></td></tr></table></figure>
<h3 id="修改网络-YUM-源"><a href="#修改网络-YUM-源" class="headerlink" title="修改网络 YUM 源"></a>修改网络 YUM 源</h3><blockquote>
<p><strong>因为yum会自动寻找下载的镜像源，所以了解即可，不需要手动配置，需要配置自行百度即可</strong></p>
</blockquote>
<h1 id="Linux定时任务设置"><a href="#Linux定时任务设置" class="headerlink" title="Linux定时任务设置"></a>Linux定时任务设置</h1><p><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/372043390">参考链接：https://zhuanlan.zhihu.com/p/372043390</a></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">安装cronie</span></span><br><span class="line">yum install cronie</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">编辑 / 创建命令【当系统不存在crontab文件时，输入此命令即为创建，已存在文件即为编辑。】</span></span><br><span class="line">crontab -e</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看当前所有定时任务</span></span><br><span class="line">crontab -l</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">删除当前所有的定时任务</span></span><br><span class="line">crontab -r</span><br></pre></td></tr></table></figure>
<h2 id="crontab格式"><a href="#crontab格式" class="headerlink" title="crontab格式"></a>crontab格式</h2><div class="table-container">
<table>
<thead>
<tr>
<th>分钟</th>
<th>小时</th>
<th>日期</th>
<th>月份</th>
<th>星期</th>
</tr>
</thead>
<tbody>
<tr>
<td>0~59</td>
<td>0~23</td>
<td>1~31</td>
<td>1~12</td>
<td>0~7（0或7代表星期日）</td>
</tr>
</tbody>
</table>
</div>
<h2 id="crontab命令操作符"><a href="#crontab命令操作符" class="headerlink" title="crontab命令操作符"></a>crontab命令操作符</h2><p>星号（*）：通配符匹配，代表所有可能的值。例如：在小时字段中，一个星号等同于每个小时；在月份字段中，一个星号则等同于每月逗号（,）：在一个字段上指定多个值。例如：“1,2,5,7,8,9”中杠（-）：指定一个值得范围。</p>
<p>例如：“2-6”表示“2,3,4,5,6”正斜线（/）：指定时间的间隔频率。例如：“0-23/2”表示每两小时执行一次</p>
<h2 id="crontab命令实例"><a href="#crontab命令实例" class="headerlink" title="crontab命令实例"></a>crontab命令实例</h2><p>每2个小时执行一次脚本 #0 <em>/2 </em> <em> </em> /test/test.sh</p>
<p>每天凌晨2点执行操作 #0 2 <em> </em> * /test/test.sh</p>
<p>每个工作日的9.am执行操作 #0 9 <em> </em> 1-5 /test/test.sh或0 9 <em> </em> 1,2,3,4,5 /test/test.sh</p>
<p>每周六、周日的6:30.pm执行操作 #30 6 <em> </em> 0,6 /test/test.sh</p>
<p>每天22：00.pm-24:00.pm之间每个30min执行操作 #0,30 22-24 <em> </em> * /test/test.sh</p>
<h2 id="crontab的特殊字符"><a href="#crontab的特殊字符" class="headerlink" title="crontab的特殊字符"></a>crontab的特殊字符</h2><p>linux中提供了8个特殊字符串用来替代crontab命令的前五个字段，这样不但可以节省时间，还可以提高可读性。</p>
<blockquote>
<p><strong>每小时运行一次<code>@hourly /test/test.sh</code></strong></p>
</blockquote>
<div class="table-container">
<table>
<thead>
<tr>
<th>特殊字符</th>
<th>含义</th>
</tr>
</thead>
<tbody>
<tr>
<td>@reboot</td>
<td>在每次启动时运行一次</td>
</tr>
<tr>
<td>@yearly</td>
<td>每年运行一次，例如：“0 0 1 1 *”</td>
</tr>
<tr>
<td>@annually</td>
<td>与@yearly用法一致</td>
</tr>
<tr>
<td>@monthly</td>
<td>每月运行一次，例如：“0 0 1 <em> </em>”</td>
</tr>
<tr>
<td>@weekly</td>
<td>每周运行一次，例如：“0 0 <em> </em> 0”</td>
</tr>
<tr>
<td>@daily</td>
<td>每天运行一次，例如：“0 0 <em> </em> *”</td>
</tr>
<tr>
<td>@midnight</td>
<td>与@daily用法一致</td>
</tr>
<tr>
<td>@hourly</td>
<td>每小时运行一次，例如：“0 <em> </em> <em> </em>”</td>
</tr>
</tbody>
</table>
</div>
<h2 id="输出重定向"><a href="#输出重定向" class="headerlink" title="输出重定向"></a>输出重定向</h2><p>当执行定时任务出现错误时，需要将信息输出，如果没有配置重定向，则默认将信息存储到相应用户下面的文件中/var/log/mail/${user}，不方便查找。因此，需要配置重定向将不同的执行脚本输出到不同的日志中。</p>
<blockquote>
<p><strong>示例：<code>0 */2 * * * /test/test.sh &gt;&gt; /home/work/log/test.log 2&gt;&amp;1</code>。其中&gt;&gt;表示将输出追加到test.log文件中，2&gt;&amp;1表示将标准错误重定向到标准输出。</strong></p>
</blockquote>
<h1 id="克隆虚拟机"><a href="#克隆虚拟机" class="headerlink" title="克隆虚拟机"></a>克隆虚拟机</h1><h1 id="常见错误及解决方案"><a href="#常见错误及解决方案" class="headerlink" title="常见错误及解决方案"></a>常见错误及解决方案</h1><h1 id="企业面试真题"><a href="#企业面试真题" class="headerlink" title="企业面试真题"></a>企业面试真题</h1></article><div class="post-copyright"><div class="post-copyright__title"><span class="post-copyright-info"><h>Linux</h></span></div><div class="post-copyright__type"><span class="post-copyright-info"><a href="https://www.naste.top:1024/posts/1406167115.html">https://www.naste.top:1024/posts/1406167115.html</a></span></div><div class="post-copyright-m"><div class="post-copyright-m-info"><div class="post-copyright-a"><h>作者</h><div class="post-copyright-cc-info"><h>XiaoFei🥝</h></div></div><div class="post-copyright-c"><h>发布于</h><div class="post-copyright-cc-info"><h>2022-07-04</h></div></div><div class="post-copyright-u"><h>更新于</h><div class="post-copyright-cc-info"><h>2024-04-26</h></div></div><div class="post-copyright-c"><h>许可协议</h><div class="post-copyright-cc-info"><a class="icon" rel="noopener" target="_blank" title="Creative Commons" href="https://creativecommons.org/"><i class="fab fa-creative-commons"></i></a><a rel="noopener" target="_blank" title="CC BY-NC-SA 4.0" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a></div></div></div></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Linux/"><div class="tags-punctuation"><svg class="faa-tada icon" style="height:1.1em;width:1.1em;fill:currentColor;position:relative;top:2px;margin-right:3px" aria-hidden="true"><use xlink:href="#icon-sekuaibiaoqian"></use></svg></div>Linux</a></div></div><link rel="stylesheet" href="/css/coin.css" media="defer" onload="this.media='all'"/><div class="post-reward"><button class="tip-button reward-button"><span class="tip-button__text">投喂作者</span><div class="coin-wrapper"><div class="coin"><div class="coin__middle"></div><div class="coin__back"></div><div class="coin__front"></div></div></div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://www.naste.top:9000/images/wechat.jpg" target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="https://www.naste.top:9000/images/wechat.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://www.naste.top:9000/images/alipay.jpg" target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="https://www.naste.top:9000/images/alipay.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></button></div><audio id="coinAudio" src="https://npm.elemecdn.com/akilar-candyassets@1.0.36/audio/aowu.m4a"></audio><script defer="defer" src="/js/coin.js"></script><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/2738765090.html"><img class="prev-cover" src= "" data-lazy-src="https://www.naste.top:9000/webp/1515952743766.webp" onerror="onerror=null;src='/assets/r2.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">服务器环境搭建</div></div></a></div><div class="next-post pull-right"><a href="/posts/75c6e52f.html"><img class="next-cover" src= "" data-lazy-src="https://www.naste.top:9000/webp/1515952743786.webp" onerror="onerror=null;src='/assets/r2.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">MySQL基本使用</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/3212903605.html" title="Docker应用安装"><img class="cover" src= "" data-lazy-src="https://www.naste.top:9000/webp/1515952743762.webp" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2024-04-26</div><div class="title">Docker应用安装</div></div></a></div><div><a href="/posts/411112023.html" title="Docker网络模式Linux"><img class="cover" src= "" data-lazy-src="https://www.naste.top:9000/webp/1678672933.webp" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2024-04-26</div><div class="title">Docker网络模式Linux</div></div></a></div><div><a href="/posts/63103794.html" title="Docker安装思源笔记软件"><img class="cover" src= "" data-lazy-src="https://www.naste.top:9000/webp/1678368278.webp" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2024-04-26</div><div class="title">Docker安装思源笔记软件</div></div></a></div><div><a href="/posts/4126800539.html" title="Docker"><img class="cover" src= "" data-lazy-src="https://www.naste.top:9000/webp/1515952743776.webp" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2024-04-26</div><div class="title">Docker</div></div></a></div><div><a href="/posts/4025993017.html" title="使用开源的wait-for-it脚本延迟Docker容器启动时间"><img class="cover" src= "" data-lazy-src="https://www.naste.top:9000/webp/1675912180.webp" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2024-04-26</div><div class="title">使用开源的wait-for-it脚本延迟Docker容器启动时间</div></div></a></div><div><a href="/posts/1226402464.html" title="Frps基本使用及使用Shell脚本启动"><img class="cover" src= "" data-lazy-src="https://www.naste.top:9000/webp/1515952743784.webp" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2024-04-26</div><div class="title">Frps基本使用及使用Shell脚本启动</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><svg class="meta_icon" style="width:22px;height:22px;position:relative;top:5px"><use xlink:href="#icon-mulu1"></use></svg><span style="font-weight:bold">目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Linux%E6%96%87%E4%BB%B6%E4%B8%8E%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84"><span class="toc-text">Linux文件与目录结构</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#VI-VM%E7%BC%96%E8%BE%91%E5%99%A8"><span class="toc-text">VI&#x2F;VM编辑器</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8vim%E6%89%93%E5%BC%80%E4%B8%80%E4%B8%AA%E6%96%87%E6%9C%AC%E6%96%87%E4%BB%B6%E8%BF%9B%E8%A1%8C%E7%BC%96%E8%BE%91"><span class="toc-text">使用vim打开一个文本文件进行编辑</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%80%E8%88%AC%E6%A8%A1%E5%BC%8F"><span class="toc-text">一般模式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BC%96%E8%BE%91%E6%A8%A1%E5%BC%8F"><span class="toc-text">编辑模式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%80%80%E5%87%BA%E7%BC%96%E8%BE%91"><span class="toc-text">退出编辑</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8C%87%E5%AE%9A%E6%A8%A1%E5%BC%8F"><span class="toc-text">指定模式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%A8%A1%E5%BC%8F%E9%97%B4%E8%BD%AC%E6%8D%A2"><span class="toc-text">模式间转换</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%BD%91%E7%BB%9C%E9%85%8D%E7%BD%AE"><span class="toc-text">网络配置</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#VMware%E4%BD%BF%E7%94%A8%E6%A1%A5%E6%8E%A5%E7%BD%91%E7%BB%9C"><span class="toc-text">VMware使用桥接网络</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#ifconfig%E6%9F%A5%E7%9C%8BLinux%E7%9A%84ip%E5%9C%B0%E5%9D%80"><span class="toc-text">ifconfig查看Linux的ip地址</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#ifconfig%E7%9C%8B%E4%B8%8D%E5%88%B0ip%E5%9C%B0%E5%9D%80"><span class="toc-text">ifconfig看不到ip地址</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%B9%E6%B3%95%E4%B8%80"><span class="toc-text">方法一</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%B9%E6%B3%95%E4%BA%8C"><span class="toc-text">方法二</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#VMware%E4%BD%BF%E7%94%A8NATA%E6%A8%A1%E5%BC%8F"><span class="toc-text">VMware使用NATA模式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ifconfig%E6%B2%A1%E6%9C%89eth0"><span class="toc-text">ifconfig没有eth0</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%B3%BB%E7%BB%9F%E7%AE%A1%E7%90%86"><span class="toc-text">系统管理</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Linux%E4%B8%AD%E7%9A%84%E8%BF%9B%E7%A8%8B%E5%92%8C%E6%9C%8D%E5%8A%A1"><span class="toc-text">Linux中的进程和服务</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#service-%E6%9C%8D%E5%8A%A1%E7%AE%A1%E7%90%86%EF%BC%88CentOS-6%E7%89%88%E6%9C%AC-%E4%BA%86%E8%A7%A3%EF%BC%89"><span class="toc-text">service 服务管理（CentOS 6版本-了解）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E6%9C%8D%E5%8A%A1"><span class="toc-text">查看服务</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#chkconfig-%E8%AE%BE%E7%BD%AE%E5%90%8E%E5%8F%B0%E6%9C%8D%E5%8A%A1%E7%9A%84%E8%87%AA%E5%90%AF%E9%85%8D%E7%BD%AE%EF%BC%88CentOS-6%E7%89%88%E6%9C%AC%EF%BC%89"><span class="toc-text">chkconfig 设置后台服务的自启配置（CentOS 6版本）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-1"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-1"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#systemctl%EF%BC%88CentOS7%E7%89%88%E6%9C%AC-%E9%87%8D%E7%82%B9%E6%8E%8C%E6%8F%A1%EF%BC%89"><span class="toc-text">systemctl（CentOS7版本-重点掌握）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-2"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E6%9C%8D%E5%8A%A1-1"><span class="toc-text">查看服务</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-2"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#sysatemetl%E8%AE%BE%E7%BD%AE%E5%90%8E%E5%8F%B0%E6%9C%8D%E5%8A%A1%E7%9A%84%E8%87%AA%E5%8A%A8%E9%85%8D%E7%BD%AE"><span class="toc-text">sysatemetl设置后台服务的自动配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-3"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-3"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%B3%BB%E7%BB%9F%E8%BF%90%E8%A1%8C%E7%BA%A7%E5%88%AB"><span class="toc-text">系统运行级别</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Linux%E7%B3%BB%E7%BB%9F%E7%9A%84%E8%BF%90%E8%A1%8C%E7%BA%A7%E5%88%AB"><span class="toc-text">Linux系统的运行级别</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#CentOS7%E7%9A%84%E8%BF%90%E8%A1%8C%E7%BA%A7%E5%88%AB%E7%AE%80%E5%8C%96%E4%B8%BA"><span class="toc-text">CentOS7的运行级别简化为</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8D%E7%9A%84%E8%BF%90%E8%A1%8C%E7%BA%A7%E5%88%AB"><span class="toc-text">查看当前的运行级别</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E5%BD%93%E5%89%8D%E7%B3%BB%E7%BB%9F%E7%9A%84%E8%BF%90%E8%A1%8C%E7%BA%A7%E5%88%AB"><span class="toc-text">修改当前系统的运行级别</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%B3%E9%97%AD%E9%98%B2%E7%81%AB%E5%A2%99"><span class="toc-text">关闭防火墙</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%B4%E6%97%B6%E5%85%B3%E9%97%AD%E9%98%B2%E7%81%AB%E5%A2%99"><span class="toc-text">临时关闭防火墙</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BC%80%E6%9C%BA%E5%90%AF%E5%8A%A8%E6%97%B6%E5%85%B3%E9%97%AD%E9%98%B2%E7%81%AB%E5%A2%99"><span class="toc-text">开机启动时关闭防火墙</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%80%E6%94%BE%E6%8C%87%E5%AE%9A%E7%AB%AF%E5%8F%A3"><span class="toc-text">开放指定端口</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%80%E5%85%B3%E6%9C%BA%E5%91%BD%E4%BB%A4"><span class="toc-text">开关机命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-4"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-4"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%9F%BA%E6%9C%AC%E5%91%BD%E4%BB%A4%EF%BC%88%E9%87%8D%E8%A6%81%EF%BC%89"><span class="toc-text">常用基本命令（重要）</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%B8%AE%E5%8A%A9%E5%91%BD%E4%BB%A4"><span class="toc-text">帮助命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#man%E8%8E%B7%E5%BE%97%E5%B8%AE%E5%8A%A9%E4%BF%A1%E6%81%AF"><span class="toc-text">man获得帮助信息</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-5"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%98%BE%E7%A4%BA%E8%AF%B4%E6%98%8E"><span class="toc-text">显示说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-5"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#help-%E8%8E%B7%E5%BE%97-shell-%E5%86%85%E7%BD%AE%E5%91%BD%E4%BB%A4%E7%9A%84%E5%B8%AE%E5%8A%A9%E4%BF%A1%E6%81%AF"><span class="toc-text">help 获得 shell 内置命令的帮助信息</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-6"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-6"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="toc-text">常用快捷键</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E7%9B%AE%E5%BD%95%E7%B1%BB"><span class="toc-text">文件目录类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#pwd-%E6%98%BE%E7%A4%BA%E5%BD%93%E5%89%8D%E5%B7%A5%E4%BD%9C%E7%9B%AE%E5%BD%95%E7%9A%84%E7%BB%9D%E5%AF%B9%E8%B7%AF%E5%BE%84"><span class="toc-text">pwd 显示当前工作目录的绝对路径</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-7"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A1%88%E4%BE%8B%E5%AE%9E%E6%93%8D"><span class="toc-text">案例实操</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#ls%E5%88%97%E5%87%BA%E7%9B%AE%E5%BD%95%E7%9A%84%E5%86%85%E5%AE%B9"><span class="toc-text">ls列出目录的内容</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-8"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%98%BE%E7%A4%BA%E8%AF%B4%E6%98%8E-1"><span class="toc-text">显示说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-7"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#cd%E5%88%87%E6%8D%A2%E7%9B%AE%E5%BD%95"><span class="toc-text">cd切换目录</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-9"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E"><span class="toc-text">参数说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-8"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#mkdir%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E6%96%B0%E7%9A%84%E7%9B%AE%E5%BD%95"><span class="toc-text">mkdir创建一个新的目录</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-10"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-1"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-9"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rmdir%E5%88%A0%E9%99%A4%E4%B8%80%E4%B8%AA%E7%A9%BA%E7%9A%84%E7%9B%AE%E5%BD%95"><span class="toc-text">rmdir删除一个空的目录</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-11"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-10"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#touch-%E5%88%9B%E5%BB%BA%E7%A9%BA%E6%96%87%E4%BB%B6"><span class="toc-text">touch 创建空文件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-12"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-11"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#cp%E5%A4%8D%E5%88%B6%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95"><span class="toc-text">cp复制文件或目录</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-13"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-2"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E-1"><span class="toc-text">参数说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-1"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-12"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rm%E5%88%A0%E9%99%A4%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95"><span class="toc-text">rm删除文件或目录</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-14"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-3"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-13"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#mv-%E7%A7%BB%E5%8A%A8%E6%96%87%E4%BB%B6%E4%B8%8E%E7%9B%AE%E5%BD%95%E6%88%96%E9%87%8D%E5%91%BD%E5%90%8D"><span class="toc-text">mv 移动文件与目录或重命名</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-15"><span class="toc-text">基本语法</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#cat-%E6%9F%A5%E7%9C%8B%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9"><span class="toc-text">cat 查看文件内容</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-16"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-4"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-14"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#more-%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9%E5%88%86%E5%B1%8F%E6%9F%A5%E7%9C%8B%E5%99%A8"><span class="toc-text">more 文件内容分屏查看器</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-17"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%93%8D%E4%BD%9C%E8%AF%B4%E6%98%8E"><span class="toc-text">操作说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-15"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#less-%E5%88%86%E5%B1%8F%E6%98%BE%E7%A4%BA%E6%96%87%E4%BB%B6%E5%86%85%E5%AE%B9"><span class="toc-text">less 分屏显示文件内容</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-18"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%93%8D%E4%BD%9C%E8%AF%B4%E6%98%8E-1"><span class="toc-text">操作说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-2"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-16"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#echo%E8%BE%93%E5%87%BA"><span class="toc-text">echo输出</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-19"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-5"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-17"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#head-%E6%98%BE%E7%A4%BA%E6%96%87%E4%BB%B6%E5%A4%B4%E9%83%A8%E5%86%85%E5%AE%B9"><span class="toc-text">head 显示文件头部内容</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-20"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-6"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-18"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#tail-%E8%BE%93%E5%87%BA%E6%96%87%E4%BB%B6%E5%B0%BE%E9%83%A8%E5%86%85%E5%AE%B9"><span class="toc-text">tail 输出文件尾部内容</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-21"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-7"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-19"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#gt-%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91%E5%92%8C-gt-gt-%E8%BF%BD%E5%8A%A0"><span class="toc-text">&gt; 输出重定向和 &gt;&gt; 追加</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-22"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-20"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#ln-%E8%BD%AF%E9%93%BE%E6%8E%A5"><span class="toc-text">ln 软链接</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-23"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-3"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-21"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#history-%E6%9F%A5%E7%9C%8B%E5%B7%B2%E7%BB%8F%E6%89%A7%E8%A1%8C%E8%BF%87%E5%8E%86%E5%8F%B2%E5%91%BD%E4%BB%A4"><span class="toc-text">history 查看已经执行过历史命令</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-24"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-22"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F%E7%B1%BB"><span class="toc-text">时间日期类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#date-%E6%98%BE%E7%A4%BA%E5%BD%93%E5%89%8D%E6%97%B6%E9%97%B4"><span class="toc-text">date 显示当前时间</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-25"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-23"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#date%E6%98%BE%E7%A4%BA%E9%9D%9E%E5%BD%93%E5%89%8D%E6%97%B6%E9%97%B4"><span class="toc-text">date显示非当前时间</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-26"><span class="toc-text">基本语法</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#date%E8%AE%BE%E7%BD%AE%E7%B3%BB%E7%BB%9F%E6%97%B6%E9%97%B4"><span class="toc-text">date设置系统时间</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-27"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-24"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#cal%E6%9F%A5%E7%9C%8B%E6%97%A5%E5%8E%86"><span class="toc-text">cal查看日历</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-28"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-8"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-25"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%94%A8%E6%88%B7%E7%AE%A1%E7%90%86%E5%91%BD%E4%BB%A4"><span class="toc-text">用户管理命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#useradd-%E6%B7%BB%E5%8A%A0%E6%96%B0%E7%94%A8%E6%88%B7"><span class="toc-text">useradd 添加新用户</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-29"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-26"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#passwd-%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%AF%86%E7%A0%81"><span class="toc-text">passwd 设置用户密码</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-30"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-27"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#id-%E6%9F%A5%E7%9C%8B%E7%94%A8%E6%88%B7%E6%98%AF%E5%90%A6%E5%AD%98%E5%9C%A8"><span class="toc-text">id 查看用户是否存在</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-31"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-28"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#cat-etc-passwd-%E6%9F%A5%E7%9C%8B%E5%88%9B%E5%BB%BA%E4%BA%86%E5%93%AA%E4%BA%9B%E7%94%A8%E6%88%B7"><span class="toc-text">cat &#x2F;etc&#x2F;passwd 查看创建了哪些用户</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-29"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#su-%E5%88%87%E6%8D%A2%E7%94%A8%E6%88%B7"><span class="toc-text">su 切换用户</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-32"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-30"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#userdel-%E5%88%A0%E9%99%A4%E7%94%A8%E6%88%B7"><span class="toc-text">userdel 删除用户</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-33"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-9"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-31"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#who-%E6%9F%A5%E7%9C%8B%E7%99%BB%E5%BD%95%E7%94%A8%E6%88%B7%E4%BF%A1%E6%81%AF"><span class="toc-text">who 查看登录用户信息</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-34"><span class="toc-text">基本语法</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#sudo-%E8%AE%BE%E7%BD%AE%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E5%85%B7%E6%9C%89-root-%E6%9D%83%E9%99%90"><span class="toc-text">sudo 设置普通用户具有 root 权限</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-32"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#usermod-%E4%BF%AE%E6%94%B9%E7%94%A8%E6%88%B7"><span class="toc-text">usermod 修改用户</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-35"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-10"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-33"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%94%A8%E6%88%B7%E7%BB%84%E7%AE%A1%E7%90%86%E5%91%BD%E4%BB%A4"><span class="toc-text">用户组管理命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#groupadd-%E6%96%B0%E5%A2%9E%E7%BB%84"><span class="toc-text">groupadd 新增组</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-36"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-34"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#groupdel-%E5%88%A0%E9%99%A4%E7%BB%84"><span class="toc-text">groupdel 删除组</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-37"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-35"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#groupmod-%E4%BF%AE%E6%94%B9%E7%BB%84"><span class="toc-text">groupmod 修改组</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-38"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9"><span class="toc-text">选项</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-36"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#cat-etc-group-%E6%9F%A5%E7%9C%8B%E5%88%9B%E5%BB%BA%E4%BA%86%E5%93%AA%E4%BA%9B%E7%BB%84"><span class="toc-text">cat  &#x2F;etc&#x2F;group 查看创建了哪些组</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-37"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E6%9D%83%E9%99%90%E7%B1%BB"><span class="toc-text">文件权限类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E5%B1%9E%E6%80%A7"><span class="toc-text">文件属性</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BB%8E%E5%B7%A6%E5%88%B0%E5%8F%B3%E7%9A%84-10-%E4%B8%AA%E5%AD%97%E7%AC%A6%E8%A1%A8%E7%A4%BA"><span class="toc-text">从左到右的 10 个字符表示</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#rwx-%E4%BD%9C%E7%94%A8%E6%96%87%E4%BB%B6%E5%92%8C%E7%9B%AE%E5%BD%95%E7%9A%84%E4%B8%8D%E5%90%8C%E8%A7%A3%E9%87%8A"><span class="toc-text">rwx 作用文件和目录的不同解释</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-38"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#chmod-%E6%94%B9%E5%8F%98%E6%9D%83%E9%99%90"><span class="toc-text">chmod 改变权限</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-4"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-39"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#chown-%E6%94%B9%E5%8F%98%E6%89%80%E6%9C%89%E8%80%85"><span class="toc-text">chown 改变所有者</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-39"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-11"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-40"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#chgrp-%E6%94%B9%E5%8F%98%E6%89%80%E5%B1%9E%E7%BB%84"><span class="toc-text">chgrp 改变所属组</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-40"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-41"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%90%9C%E7%B4%A2%E6%9F%A5%E6%89%BE%E7%B1%BB"><span class="toc-text">搜索查找类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#find%E6%9F%A5%E6%89%BE%E6%96%87%E4%BB%B6%E6%88%96%E8%80%85%E7%9B%AE%E5%BD%95"><span class="toc-text">find查找文件或者目录</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-41"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-12"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-42"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#locate-%E5%BF%AB%E9%80%9F%E5%AE%9A%E4%BD%8D%E6%96%87%E4%BB%B6%E8%B7%AF%E5%BE%84"><span class="toc-text">locate 快速定位文件路径</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-42"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-5"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-43"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#grep-%E8%BF%87%E6%BB%A4%E6%9F%A5%E6%89%BE%E5%8F%8A%E2%80%9C-%E2%80%9D%E7%AE%A1%E9%81%93%E7%AC%A6"><span class="toc-text">grep 过滤查找及“|”管道符</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-43"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-13"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-44"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8E%8B%E7%BC%A9%E5%92%8C%E8%A7%A3%E5%8E%8B%E7%B1%BB"><span class="toc-text">压缩和解压类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#gzip-gunzip-%E5%8E%8B%E7%BC%A9"><span class="toc-text">gzip&#x2F;gunzip 压缩</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-44"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-6"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-45"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#zip-unzip-%E5%8E%8B%E7%BC%A9"><span class="toc-text">zip&#x2F;unzip 压缩</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-45"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-14"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-7"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-46"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#tar-%E6%89%93%E5%8C%85"><span class="toc-text">tar 打包</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-46"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-15"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-47"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%A3%81%E7%9B%98%E6%9F%A5%E7%9C%8B%E5%92%8C%E5%88%86%E5%8C%BA%E7%B1%BB"><span class="toc-text">磁盘查看和分区类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#du-%E6%9F%A5%E7%9C%8B%E6%96%87%E4%BB%B6%E5%92%8C%E7%9B%AE%E5%BD%95%E5%8D%A0%E7%94%A8%E7%9A%84%E7%A3%81%E7%9B%98%E7%A9%BA%E9%97%B4"><span class="toc-text">du 查看文件和目录占用的磁盘空间</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-47"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-16"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-48"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#df-%E6%9F%A5%E7%9C%8B%E7%A3%81%E7%9B%98%E7%A9%BA%E9%97%B4%E4%BD%BF%E7%94%A8%E6%83%85%E5%86%B5"><span class="toc-text">df 查看磁盘空间使用情况</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-48"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-17"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-49"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#lsblk-%E6%9F%A5%E7%9C%8B%E8%AE%BE%E5%A4%87%E6%8C%82%E8%BD%BD%E6%83%85%E5%86%B5"><span class="toc-text">lsblk 查看设备挂载情况</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-49"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E9%80%89%E9%A1%B9"><span class="toc-text">查看选项</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#mount-umount-%E6%8C%82%E8%BD%BD-%E5%8D%B8%E8%BD%BD"><span class="toc-text">mount&#x2F;umount 挂载&#x2F;卸载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#fdisk-%E5%88%86%E5%8C%BA"><span class="toc-text">fdisk 分区</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-50"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-18"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-8"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8A%9F%E8%83%BD%E8%AF%B4%E6%98%8E"><span class="toc-text">功能说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-50"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BF%9B%E7%A8%8B%E7%AE%A1%E7%90%86%E7%B1%BB"><span class="toc-text">进程管理类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#ps-%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8D%E7%B3%BB%E7%BB%9F%E8%BF%9B%E7%A8%8B%E7%8A%B6%E6%80%81"><span class="toc-text">ps 查看当前系统进程状态</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-51"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-19"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8A%9F%E8%83%BD%E8%AF%B4%E6%98%8E-1"><span class="toc-text">功能说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-9"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-51"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#kill-%E7%BB%88%E6%AD%A2%E8%BF%9B%E7%A8%8B"><span class="toc-text">kill 终止进程</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-52"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-20"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-52"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#pstree-%E6%9F%A5%E7%9C%8B%E8%BF%9B%E7%A8%8B%E6%A0%91"><span class="toc-text">pstree 查看进程树</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-53"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-21"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-53"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#top-%E5%AE%9E%E6%97%B6%E7%9B%91%E6%8E%A7%E7%B3%BB%E7%BB%9F%E8%BF%9B%E7%A8%8B%E7%8A%B6%E6%80%81"><span class="toc-text">top 实时监控系统进程状态</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E5%91%BD%E4%BB%A4"><span class="toc-text">基本命令</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-22"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%93%8D%E4%BD%9C%E8%AF%B4%E6%98%8E-2"><span class="toc-text">操作说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%9F%A5%E8%AF%A2%E7%BB%93%E6%9E%9C%E5%AD%97%E6%AE%B5%E8%A7%A3%E9%87%8A"><span class="toc-text">查询结果字段解释</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-54"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#netstat-%E6%98%BE%E7%A4%BA%E7%BD%91%E7%BB%9C%E7%8A%B6%E6%80%81%E5%92%8C%E7%AB%AF%E5%8F%A3%E5%8D%A0%E7%94%A8%E4%BF%A1%E6%81%AF"><span class="toc-text">netstat 显示网络状态和端口占用信息</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-54"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-23"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-55"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#crontab-%E7%B3%BB%E7%BB%9F%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1"><span class="toc-text">crontab 系统定时任务</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#crontab-%E6%9C%8D%E5%8A%A1%E7%AE%A1%E7%90%86"><span class="toc-text">crontab 服务管理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#crontab-%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%E8%AE%BE%E7%BD%AE"><span class="toc-text">crontab 定时任务设置</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-55"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-24"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E-2"><span class="toc-text">参数说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-56"><span class="toc-text">使用</span></a></li></ol></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%BD%AF%E4%BB%B6%E5%8C%85%E7%AE%A1%E7%90%86"><span class="toc-text">软件包管理</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#RPM"><span class="toc-text">RPM</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#RPM%E6%A6%82%E8%BF%B0"><span class="toc-text">RPM概述</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RPM-%E6%9F%A5%E8%AF%A2%E5%91%BD%E4%BB%A4%EF%BC%88rpm-qa%EF%BC%89"><span class="toc-text">RPM 查询命令（rpm -qa）</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-56"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%8F%E9%AA%8C%E6%8A%80%E5%B7%A7-10"><span class="toc-text">经验技巧</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-57"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RPM-%E5%8D%B8%E8%BD%BD%E5%91%BD%E4%BB%A4%EF%BC%88rpm-e%EF%BC%89"><span class="toc-text">RPM 卸载命令（rpm -e）</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-57"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-25"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-58"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RPM-%E5%AE%89%E8%A3%85%E5%91%BD%E4%BB%A4%EF%BC%88rpm-ivh%EF%BC%89"><span class="toc-text">RPM 安装命令（rpm -ivh）</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-58"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-26"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-59"><span class="toc-text">使用</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#YUM%E4%BB%93%E5%BA%93%E9%85%8D%E7%BD%AE"><span class="toc-text">YUM仓库配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#YUN%E6%A6%82%E8%BF%B0"><span class="toc-text">YUN概述</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#YUM%E7%9A%84%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="toc-text">YUM的常用命令</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95-59"><span class="toc-text">基本语法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E-27"><span class="toc-text">选项说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E-3"><span class="toc-text">参数说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-60"><span class="toc-text">使用</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E7%BD%91%E7%BB%9C-YUM-%E6%BA%90"><span class="toc-text">修改网络 YUM 源</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Linux%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%E8%AE%BE%E7%BD%AE"><span class="toc-text">Linux定时任务设置</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#crontab%E6%A0%BC%E5%BC%8F"><span class="toc-text">crontab格式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#crontab%E5%91%BD%E4%BB%A4%E6%93%8D%E4%BD%9C%E7%AC%A6"><span class="toc-text">crontab命令操作符</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#crontab%E5%91%BD%E4%BB%A4%E5%AE%9E%E4%BE%8B"><span class="toc-text">crontab命令实例</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#crontab%E7%9A%84%E7%89%B9%E6%AE%8A%E5%AD%97%E7%AC%A6"><span class="toc-text">crontab的特殊字符</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BE%93%E5%87%BA%E9%87%8D%E5%AE%9A%E5%90%91"><span class="toc-text">输出重定向</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%8B%E9%9A%86%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-text">克隆虚拟机</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%B8%B8%E8%A7%81%E9%94%99%E8%AF%AF%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88"><span class="toc-text">常见错误及解决方案</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BC%81%E4%B8%9A%E9%9D%A2%E8%AF%95%E7%9C%9F%E9%A2%98"><span class="toc-text">企业面试真题</span></a></li></ol></div></div></div></div></main><footer id="footer" style="background-color: transparent;"><div id="footer-wrap"><div id="ft"><div class="ft-item-1"><div class="t-top"><div class="t-t-l"><p class="ft-t t-l-t">格言🧬</p><div class="bg-ad"><div>再看看那个光点，它就在这里，这是家园，这是我们 —— 你所爱的每一个人，你认识的一个人，你听说过的每一个人，曾经有过的每一个人，都在它上面度过他们的一生✨</div><div class="btn-xz-box"><a class="btn-xz" target="_blank" rel="noopener" href="https://stellarium.org/">点击开启星辰之旅</a></div></div></div><div class="t-t-r"><p class="ft-t t-l-t">猜你想看💡</p><ul class="ft-links"><li><a href="/posts/eec9786.html">魔改指南</a><a href="/box/nav/">网址导航</a></li><li><a href="/social/link/">我的朋友</a><a href="/comments/">留点什么</a></li><li><a href="/personal/about/">关于作者</a><a href="/archives/">文章归档</a></li><li><a href="/categories/">文章分类</a><a href="/tags/">文章标签</a></li><li><a href="/box/Gallery/">我的画廊</a><a href="/personal/bb/">我的唠叨</a></li><li><a href="/site/time/">建设进程</a><a href="/site/census/">网站统计</a></li></ul></div></div></div><div class="ft-item-2"><p class="ft-t">推荐友链⌛</p><div class="ft-img-group"><div class="img-group-item"><a href="https://www.naste.top:1024/" title="XiaoFei🥝"><img src= "" data-lazy-src="https://www.naste.top:9000/images/cat.jpg" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://www.naste.top:9000/webp/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://www.naste.top:9000/webp/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://www.naste.top:9000/webp/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://www.naste.top:9000/webp/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://www.naste.top:9000/webp/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://www.naste.top:9000/webp/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://www.naste.top:9000/webp/65307a5828af6790.webp" alt=""/></a></div></div></div></div><div class="copyright"><span><b>&copy;2022-2024</b></span><span><b>&nbsp;&nbsp;By XiaoFei🥝</b></span></div><div id="workboard"></div><p id="ghbdages"><a class="github-badge" target="_blank" href="https://hexo.io/" style="margin-inline:5px" title="博客框架为Hexo_v6.3.0"><img src= "" data-lazy-src="https://static.naste.top:1024/svg/blog/Frame-Hexo-blue.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://butterfly.js.org/" style="margin-inline:5px" title="主题版本Butterfly_v4.3.1"><img src= "" data-lazy-src="https://static.naste.top:1024/svg/blog/Theme-Butterfly-6513df.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://vercel.com/" style="margin-inline:5px" title="本站采用多线部署，主线路托管于Vercel"><img src= "" data-lazy-src="https://static.naste.top:1024/svg/blog/Hosted-Vercel-brightgreen.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://user.51.la/" style="margin-inline:5px" title="本站数据分析得益于51la技术支持"><img src= "" data-lazy-src="https://static.naste.top:1024/svg/blog/Analytics-51la-3db1eb.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://github.com/" style="margin-inline:5px" title="本网站源码由Github提供存储仓库"><img src= "" data-lazy-src=" https://static.naste.top:1024/svg/blog/Source-Github-d021d6.svg" alt=""/></a></p></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><a class="icon-V hidden" onclick="switchNightMode()" title="浅色和深色模式转换"><svg width="25" height="25" viewBox="0 0 1024 1024"><use id="modeicon" xlink:href="#icon-moon"></use></svg></a><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button><button class="share" type="button" title="右键模式" onclick="changeMouseMode()"><i class="fas fa-mouse"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog right_side"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button class="share" type="button" title="分享链接" onclick="share()"><i class="fas fa-share-nodes"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i><span id="percent">0<span>%</span></span></button><button id="go-down" type="button" title="直达底部" onclick="btf.scrollToDest(document.body.scrollHeight, 500)"><i class="fas fa-arrow-down"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div class="js-pjax" id="rightMenu"><div class="rightMenu-group rightMenu-small"><a class="rightMenu-item" href="javascript:window.history.back();"><i class="fa fa-arrow-left"></i></a><a class="rightMenu-item" href="javascript:window.history.forward();"><i class="fa fa-arrow-right"></i></a><a class="rightMenu-item" href="javascript:window.location.reload();"><i class="fa fa-refresh"></i></a><a class="rightMenu-item" href="javascript:rmf.scrollToTop();"><i class="fa fa-arrow-up"></i></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-text"><a class="rightMenu-item" href="javascript:rmf.copySelect();"><i class="fa fa-copy"></i><span>复制</span></a><a class="rightMenu-item" href="javascript:window.open(&quot;https://www.baidu.com/s?wd=&quot;+window.getSelection().toString());window.location.reload();"><i class="fa fa-search"></i><span>百度搜索</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-too"><a class="rightMenu-item" href="javascript:window.open(window.getSelection().toString());window.location.reload();"><i class="fa fa-link"></i><span>转到链接</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-paste"><a class="rightMenu-item" href="javascript:rmf.paste()"><i class="fa fa-copy"></i><span>粘贴</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-post"><a class="rightMenu-item" href="#post-comment"><i class="fas fa-comment"></i><span>空降评论</span></a><a class="rightMenu-item" href="javascript:rmf.copyWordsLink()"><i class="fa fa-link"></i><span>复制本文地址</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-to"><a class="rightMenu-item" href="javascript:rmf.openWithNewTab()"><i class="fa fa-window-restore"></i><span>新窗口打开</span></a><a class="rightMenu-item" id="menu-too" href="javascript:rmf.open()"><i class="fa fa-link"></i><span>转到链接</span></a><a class="rightMenu-item" href="javascript:rmf.copyLink()"><i class="fa fa-copy"></i><span>复制链接</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-img"><a class="rightMenu-item" href="javascript:rmf.saveAs()"><i class="fa fa-download"></i><span>保存图片</span></a><a class="rightMenu-item" href="javascript:rmf.openWithNewTab()"><i class="fa fa-window-restore"></i><span>在新窗口打开</span></a><a class="rightMenu-item" href="javascript:rmf.copyLink()"><i class="fa fa-copy"></i><span>复制图片链接</span></a></div><div class="rightMenu-group rightMenu-line"><a class="rightMenu-item" href="javascript:randomPost()"><i class="fa fa-paper-plane"></i><span>随便逛逛</span></a><a class="rightMenu-item" href="javascript:switchNightMode();"><i class="fa fa-moon"></i><span>昼夜切换</span></a><a class="rightMenu-item" href="/personal/about/"><i class="fa fa-info-circle"></i><span>关于博客</span></a><a class="rightMenu-item" href="javascript:toggleWinbox();"><i class="fas fa-cog"></i><span>美化设置</span></a><a class="rightMenu-item" href="javascript:rmf.fullScreen();"><i class="fas fa-expand"></i><span>切换全屏</span></a><a class="rightMenu-item" href="javascript:window.print();"><i class="fa-solid fa-print"></i><span>打印页面</span></a></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.staticfile.org/fancyapps-ui/4.0.31/fancybox.umd.min.js"></script><script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/instant.page/5.1.0/instantpage.min.js" type="module"></script><script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vanilla-lazyload/17.3.1/lazyload.iife.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdnjs.cloudflare.com/ajax/libs/pangu/4.0.7/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (true){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><script src="/js/search/local-search.js"></script><script async="async">var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())
setTimeout(function(){preloader.endLoading();}, 5000);
document.getElementById('loading-box').addEventListener('click',()=> {preloader.endLoading()})</script><div class="js-pjax"><script>(()=>{
  const init = () => {
    twikoo.init(Object.assign({
      el: '#twikoo-wrap',
      envId: '',
      region: '',
      onCommentLoaded: function () {
        btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
      }
    }, null))
  }

  const getCount = () => {
    const countELement = document.getElementById('twikoo-count')
    if(!countELement) return
    twikoo.getCommentsCount({
      envId: '',
      region: '',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      countELement.innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const runFn = () => {
    init()
    
  }

  const loadTwikoo = () => {
    if (typeof twikoo === 'object') {
      setTimeout(runFn,0)
      return
    } 
    getScript('https://cdn.staticfile.org/twikoo/1.6.8/twikoo.all.min.js').then(runFn)
  }

  if ('Twikoo' === 'Twikoo' || !true) {
    if (true) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo()
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><script src="https://cdn.staticfile.org/jquery/3.6.3/jquery.min.js"></script><script async src="https://cdn1.tianli0.top/npm/vue@2.6.14/dist/vue.min.js"></script><script async src="https://cdn1.tianli0.top/npm/element-ui@2.15.6/lib/index.js"></script><script async src="https://cdn.bootcdn.net/ajax/libs/clipboard.js/2.0.11/clipboard.min.js"></script><script defer type="text/javascript" src="https://cdn1.tianli0.top/npm/sweetalert2@8.19.0/dist/sweetalert2.all.js"></script><script async src="//npm.elemecdn.com/pace-js@1.2.4/pace.min.js"></script><script defer src="https://cdn1.tianli0.top/gh/nextapps-de/winbox/dist/winbox.bundle.min.js"></script><script async src="//at.alicdn.com/t/c/font_3586335_hsivh70x0fm.js"></script><script async src="//at.alicdn.com/t/c/font_3636804_gr02jmjr3y9.js"></script><script async src="//at.alicdn.com/t/c/font_3612150_kfv55xn3u2g.js"></script><script async src="https://cdn.wpon.cn/2022-sucai/Gold-ingot.js"></script><canvas id="universe"></canvas><canvas id="snow"></canvas><script defer src="/js/fomal.js"></script><link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/aplayer/1.10.1/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/aplayer/1.10.1/APlayer.min.js"></script><script src="https://cdn1.tianli0.top/npm/js-heo@1.0.12/metingjs/Meting.min.js"></script><script src="https://lib.baomitu.com/pjax/0.2.8/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show","#web_bg",".js-pjax","#bibi","body > title","#app","#tag-echarts","#posts-echart","#categories-echarts"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

  typeof disqusjs === 'object' && disqusjs.destroy()
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --> <script data-pjax>if(document.getElementById('recent-posts') && (location.pathname ==='/'|| '/' ==='all')){
    var parent = document.getElementById('recent-posts');
    var child = '<div class="recent-post-item" style="width:100%;height: auto"><div id="catalog_magnet"><div class="magnet_item"><a class="magnet_link" href="https://www.naste.top:1024/categories/Java/"><div class="magnet_link_context" style=""><span style="font-weight:500;flex:1">🍡 XiaoFeiのJava学习笔记 (55)</span><span style="padding:0px 4px;border-radius: 8px;"><i class="fas fa-arrow-circle-right"></i></span></div></a></div><div class="magnet_item"><a class="magnet_link" href="https://www.naste.top:1024/categories/Linux/"><div class="magnet_link_context" style=""><span style="font-weight:500;flex:1">🍼 XiaoFeiのLinux笔记 (33)</span><span style="padding:0px 4px;border-radius: 8px;"><i class="fas fa-arrow-circle-right"></i></span></div></a></div><div class="magnet_item"><a class="magnet_link" href="https://www.naste.top:1024/categories/Python/"><div class="magnet_link_context" style=""><span style="font-weight:500;flex:1">🍉 XiaoFeiのPython笔记 (2)</span><span style="padding:0px 4px;border-radius: 8px;"><i class="fas fa-arrow-circle-right"></i></span></div></a></div><div class="magnet_item"><a class="magnet_link" href="https://www.naste.top:1024/categories/前端/"><div class="magnet_link_context" style=""><span style="font-weight:500;flex:1">🍟 XiaoFeiの前端笔记 (17)</span><span style="padding:0px 4px;border-radius: 8px;"><i class="fas fa-arrow-circle-right"></i></span></div></a></div><div class="magnet_item"><a class="magnet_link" href="https://www.naste.top:1024/categories/Other/"><div class="magnet_link_context" style=""><span style="font-weight:500;flex:1">🍥 XiaoFeiのOther笔记 (10)</span><span style="padding:0px 4px;border-radius: 8px;"><i class="fas fa-arrow-circle-right"></i></span></div></a></div><div class="magnet_item" style="visibility: hidden"></div><a class="magnet_link_more"  href="https://www.naste.top:1024/categories/" style="flex:1;text-align: center;margin-bottom: 10px;">查看更多...</a></div></div>';
    console.log('已挂载magnet')
    parent.insertAdjacentHTML("afterbegin",child)}
     </script><style>#catalog_magnet{flex-wrap: wrap;display: flex;width:100%;justify-content:space-between;padding: 10px 10px 0 10px;align-content: flex-start;}.magnet_item{flex-basis: calc(33.333333333333336% - 5px);background: #e9e9e9;margin-bottom: 10px;border-radius: 8px;transition: all 0.2s ease-in-out;}.magnet_item:hover{background: var(--text-bg-hover)}.magnet_link_more{color:#555}.magnet_link{color:black}.magnet_link:hover{color:white}@media screen and (max-width: 600px) {.magnet_item {flex-basis: 100%;}}.magnet_link_context{display:flex;padding: 10px;font-size:16px;transition: all 0.2s ease-in-out;}.magnet_link_context:hover{padding: 10px 20px;}</style>
    <style></style><script data-pjax>
  function butterfly_swiper_injector_config(){
    var parent_div_git = document.getElementById('recent-posts');
    var item_html = '<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/204253054.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://www.naste.top:9000/webp/1675912191.webp" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-03-08</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/204253054.html&quot;);" href="javascript:void(0);" alt="">SpringBoot使用实现定时任务和xxl-job实现分布式任务调度</a><div class="blog-slider__text">SpringBoot使用实现定时任务和xxl-job实现分布式任务调度</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/204253054.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/538133837.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://www.naste.top:9000/webp/1678672933.webp" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-03-15</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/538133837.html&quot;);" href="javascript:void(0);" alt="">Hexo中Markdown语法与外挂标签写法汇总</a><div class="blog-slider__text">Hexo中Markdown语法与外挂标签写法汇总</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/538133837.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>';
    console.log('已挂载butterfly_swiper')
    parent_div_git.insertAdjacentHTML("afterbegin",item_html)
    }
  var elist = 'undefined'.split(',');
  var cpage = location.pathname;
  var epage = '/';
  var flag = 0;

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    butterfly_swiper_injector_config();
  }
  else if (epage === cpage){
    butterfly_swiper_injector_config();
  }
  </script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js"></script><script defer data-pjax src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js"></script><div class="js-pjax"><script async="async">var arr = document.getElementsByClassName('recent-post-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '2s');
    arr[i].setAttribute('data-wow-delay', '200ms');
    arr[i].setAttribute('data-wow-offset', '30');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script><script async="async">var arr = document.getElementsByClassName('card-widget');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '2s');
    arr[i].setAttribute('data-wow-delay', '200ms');
    arr[i].setAttribute('data-wow-offset', '30');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script></div><script defer src="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/wow_init.js"></script><script data-pjax src="https://npm.elemecdn.com/hexo-filter-gitcalendar/lib/gitcalendar.js"></script><script data-pjax>
  function gitcalendar_injector_config(){
      var parent_div_git = document.getElementById('gitZone');
      var item_html = '<div class="recent-post-item" id="gitcalendarBar" style="width:100%;height:auto;padding:10px;"><style>#git_container{min-height: 320px}@media screen and (max-width:650px) {#git_container{min-height: 0px}}</style><div id="git_loading" style="width:10%;height:100%;margin:0 auto;display: block;"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animatetransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animatetransform></path></svg><style>#git_container{display: none;}</style></div><div id="git_container"></div></div>';
      parent_div_git.insertAdjacentHTML("afterbegin",item_html)
      console.log('已挂载gitcalendar')
      }

    if( document.getElementById('gitZone') && (location.pathname ==='/personal/about/'|| '/personal/about/' ==='all')){
        gitcalendar_injector_config()
        GitCalendarInit("https://gitcalendar.naste.top/api?xiao-i-fei",['#d9e0df', '#c6e0dc', '#a8dcd4', '#9adcd2', '#89ded1', '#77e0d0', '#5fdecb', '#47dcc6', '#39dcc3', '#1fdabe', '#00dab9'],'xiao-i-fei')
    }
  </script><!-- hexo injector body_end end --></body></html>